<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE CPP, NoImplicitPrelude, ScopedTypeVariables, MagicHash #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE BangPatterns #-}</span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      :  GHC.List</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 1994-2002</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  non-portable (GHC Extensions)</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- The List data type and its operations</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.List</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-21"></span><span>   </span><span class="hs-comment">-- [] (..),          -- built-in syntax; can't be used in export list</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span>   </span><span class="annot"><a href="GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Base.html#%2B%2B"><span class="hs-operator">(++)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#filter"><span class="hs-identifier">filter</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>   </span><span class="annot"><a href="GHC.List.html#head"><span class="hs-identifier">head</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#last"><span class="hs-identifier">last</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#tail"><span class="hs-identifier">tail</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#init"><span class="hs-identifier">init</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#uncons"><span class="hs-identifier">uncons</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#null"><span class="hs-identifier">null</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#length"><span class="hs-identifier">length</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#%21%21"><span class="hs-operator">(!!)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>   </span><span class="annot"><a href="GHC.List.html#foldl"><span class="hs-identifier">foldl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#foldl1"><span class="hs-identifier">foldl1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#foldl1%27"><span class="hs-identifier">foldl1'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#scanl"><span class="hs-identifier">scanl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#scanl1"><span class="hs-identifier">scanl1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#scanl%27"><span class="hs-identifier">scanl'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-identifier">foldr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#foldr1"><span class="hs-identifier">foldr1</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>   </span><span class="annot"><a href="GHC.List.html#scanr"><span class="hs-identifier">scanr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#scanr1"><span class="hs-identifier">scanr1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#iterate"><span class="hs-identifier">iterate</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#iterate%27"><span class="hs-identifier">iterate'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#repeat"><span class="hs-identifier">repeat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#replicate"><span class="hs-identifier">replicate</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#cycle"><span class="hs-identifier">cycle</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>   </span><span class="annot"><a href="GHC.List.html#take"><span class="hs-identifier">take</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#drop"><span class="hs-identifier">drop</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#sum"><span class="hs-identifier">sum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#product"><span class="hs-identifier">product</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#maximum"><span class="hs-identifier">maximum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#minimum"><span class="hs-identifier">minimum</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#takeWhile"><span class="hs-identifier">takeWhile</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#dropWhile"><span class="hs-identifier">dropWhile</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-28"></span><span>   </span><span class="annot"><a href="GHC.List.html#span"><span class="hs-identifier">span</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#break"><span class="hs-identifier">break</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#reverse"><span class="hs-identifier">reverse</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#and"><span class="hs-identifier">and</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#or"><span class="hs-identifier">or</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>   </span><span class="annot"><a href="GHC.List.html#any"><span class="hs-identifier">any</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#all"><span class="hs-identifier">all</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#elem"><span class="hs-identifier">elem</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#notElem"><span class="hs-identifier">notElem</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#lookup"><span class="hs-identifier">lookup</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>   </span><span class="annot"><a href="GHC.List.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>   </span><span class="annot"><a href="GHC.List.html#zip"><span class="hs-identifier">zip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#zip3"><span class="hs-identifier">zip3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith"><span class="hs-identifier">zipWith</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith3"><span class="hs-identifier">zipWith3</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#unzip"><span class="hs-identifier">unzip</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#unzip3"><span class="hs-identifier">unzip3</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>   </span><span class="annot"><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier">errorEmptyList</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-35"></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Maybe.html"><span class="hs-identifier">Data.Maybe</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Base.html"><span class="hs-identifier">GHC.Base</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Num.html"><span class="hs-identifier">GHC.Num</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier">Num</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#"><span class="hs-identifier">GHC.Num.Integer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-identifier">Integer</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">9</span><span>  </span><span class="annot"><a href="GHC.List.html#%21%21"><span class="hs-operator hs-type">!!</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">infix</span><span>  </span><span class="hs-number">4</span><span> </span><span class="annot"><a href="GHC.List.html#elem"><span class="hs-operator hs-type">`elem`</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.List.html#notElem"><span class="hs-operator hs-type">`notElem`</span></a></span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span class="hs-comment">-- $setup</span><span>
</span><span id="line-45"></span><span class="hs-comment">-- &gt;&gt;&gt; import GHC.Base</span><span>
</span><span id="line-46"></span><span class="hs-comment">-- &gt;&gt;&gt; import Prelude (Num (..), Ord (..), Int, Double, odd, not, undefined)</span><span>
</span><span id="line-47"></span><span class="hs-comment">-- &gt;&gt;&gt; import Control.DeepSeq (force)</span><span>
</span><span id="line-48"></span><span class="hs-comment">--</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- -- compiled versions are uninterruptible.</span><span>
</span><span id="line-50"></span><span class="hs-comment">-- https://gitlab.haskell.org/ghc/ghc/-/issues/367</span><span>
</span><span id="line-51"></span><span class="hs-comment">--</span><span>
</span><span id="line-52"></span><span class="hs-comment">-- &gt;&gt;&gt; let or  = foldr (||) False</span><span>
</span><span id="line-53"></span><span class="hs-comment">-- &gt;&gt;&gt; let and = foldr (&amp;&amp;) True</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-56"></span><span class="hs-comment">-- List-manipulation functions</span><span>
</span><span id="line-57"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-comment">-- | \(\mathcal{O}(1)\). Extract the first element of a list, which must be non-empty.</span><span>
</span><span id="line-60"></span><span class="hs-comment">--</span><span>
</span><span id="line-61"></span><span class="hs-comment">-- &gt;&gt;&gt; head [1, 2, 3]</span><span>
</span><span id="line-62"></span><span class="hs-comment">-- 1</span><span>
</span><span id="line-63"></span><span class="hs-comment">-- &gt;&gt;&gt; head [1..]</span><span>
</span><span id="line-64"></span><span class="hs-comment">-- 1</span><span>
</span><span id="line-65"></span><span class="hs-comment">-- &gt;&gt;&gt; head []</span><span>
</span><span id="line-66"></span><span class="hs-comment">-- Exception: Prelude.head: empty list</span><span>
</span><span id="line-67"></span><span id="local-6989586621679486577"><span class="annot"><a href="GHC.List.html#head"><span class="hs-identifier hs-type">head</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486577"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486577"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-68"></span><span id="head"><span class="annot"><span class="annottext">head :: forall a. [a] -&gt; a
</span><a href="GHC.List.html#head"><span class="hs-identifier hs-var hs-var">head</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486245"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486245"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486245"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-69"></span><span class="annot"><a href="GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
forall a. a
</span><a href="GHC.List.html#badHead"><span class="hs-identifier hs-var">badHead</span></a></span><span>
</span><span id="line-70"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span id="local-6989586621679486575"><span class="annot"><a href="GHC.List.html#badHead"><span class="hs-identifier hs-type">badHead</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486575"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-73"></span><span id="badHead"><span class="annot"><span class="annottext">badHead :: forall a. a
</span><a href="GHC.List.html#badHead"><span class="hs-identifier hs-var hs-var">badHead</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;head&quot;</span></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="hs-comment">-- This rule is useful in cases like</span><span>
</span><span id="line-76"></span><span class="hs-comment">--      head [y | (x,y) &lt;- ps, x==t]</span><span>
</span><span id="line-77"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-78"></span><span id="local-6989586621679486243"><span class="annot"><span class="hs-pragma">&quot;head/build&quot;</span></span><span>    </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679486242"><span class="annot"><a href="#local-6989586621679486242"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486241"><span class="annot"><a href="#local-6989586621679486241"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679486243"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679486241"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679486241"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679486241"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679486241"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-79"></span><span>                </span><span class="annot"><a href="GHC.List.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486242"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679486242"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486240"><span class="annot"><a href="#local-6989586621679486240"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-pragma">_</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486240"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="GHC.List.html#badHead"><span class="hs-pragma hs-type">badHead</span></a></span></span><span>
</span><span id="line-80"></span><span id="local-6989586621679486239"><span class="annot"><span class="hs-pragma">&quot;head/augment&quot;</span></span><span>  </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486238"><span class="annot"><a href="#local-6989586621679486238"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679486237"><span class="annot"><a href="#local-6989586621679486237"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486236"><span class="annot"><a href="#local-6989586621679486236"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679486239"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679486236"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679486236"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486236"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486236"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-81"></span><span>                </span><span class="annot"><a href="GHC.List.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#augment"><span class="hs-pragma hs-type">augment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486237"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486238"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679486237"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486235"><span class="annot"><a href="#local-6989586621679486235"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="hs-pragma">_</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486235"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486238"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span></span><span>
</span><span id="line-82"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="hs-comment">-- | \(\mathcal{O}(1)\). Decompose a list into its head and tail.</span><span>
</span><span id="line-85"></span><span class="hs-comment">--</span><span>
</span><span id="line-86"></span><span class="hs-comment">-- * If the list is empty, returns 'Nothing'.</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- * If the list is non-empty, returns @'Just' (x, xs)@,</span><span>
</span><span id="line-88"></span><span class="hs-comment">-- where @x@ is the head of the list and @xs@ its tail.</span><span>
</span><span id="line-89"></span><span class="hs-comment">--</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- @since 4.8.0.0</span><span>
</span><span id="line-91"></span><span class="hs-comment">--</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- &gt;&gt;&gt; uncons []</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- &gt;&gt;&gt; uncons [1]</span><span>
</span><span id="line-95"></span><span class="hs-comment">-- Just (1,[])</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- &gt;&gt;&gt; uncons [1, 2, 3]</span><span>
</span><span id="line-97"></span><span class="hs-comment">-- Just (1,[2,3])</span><span>
</span><span id="line-98"></span><span id="local-6989586621679486572"><span class="annot"><a href="GHC.List.html#uncons"><span class="hs-identifier hs-type">uncons</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486572"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486572"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486572"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-99"></span><span id="uncons"><span class="annot"><span class="annottext">uncons :: forall a. [a] -&gt; Maybe (a, [a])
</span><a href="GHC.List.html#uncons"><span class="hs-identifier hs-var hs-var">uncons</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (a, [a])
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-100"></span><span class="annot"><a href="GHC.List.html#uncons"><span class="hs-identifier hs-var">uncons</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486234"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486234"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486233"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486233"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, [a]) -&gt; Maybe (a, [a])
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486234"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486233"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span class="hs-comment">-- | \(\mathcal{O}(1)\). Extract the elements after the head of a list, which</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- must be non-empty.</span><span>
</span><span id="line-104"></span><span class="hs-comment">--</span><span>
</span><span id="line-105"></span><span class="hs-comment">-- &gt;&gt;&gt; tail [1, 2, 3]</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- [2,3]</span><span>
</span><span id="line-107"></span><span class="hs-comment">-- &gt;&gt;&gt; tail [1]</span><span>
</span><span id="line-108"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- &gt;&gt;&gt; tail []</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- Exception: Prelude.tail: empty list</span><span>
</span><span id="line-111"></span><span id="local-6989586621679486569"><span class="annot"><a href="GHC.List.html#tail"><span class="hs-identifier hs-type">tail</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486569"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486569"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-112"></span><span id="tail"><span class="annot"><span class="annottext">tail :: forall a. [a] -&gt; [a]
</span><a href="GHC.List.html#tail"><span class="hs-identifier hs-var hs-var">tail</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486232"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486232"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486232"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-113"></span><span class="annot"><a href="GHC.List.html#tail"><span class="hs-identifier hs-var">tail</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; [a]
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tail&quot;</span></span><span>
</span><span id="line-114"></span><span>
</span><span id="line-115"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). Extract the last element of a list, which must be</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- finite and non-empty.</span><span>
</span><span id="line-117"></span><span class="hs-comment">--</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- &gt;&gt;&gt; last [1, 2, 3]</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- 3</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- &gt;&gt;&gt; last [1..]</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- &gt;&gt;&gt; last []</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- Exception: Prelude.last: empty list</span><span>
</span><span id="line-124"></span><span id="local-6989586621679486231"><span class="annot"><a href="GHC.List.html#last"><span class="hs-identifier hs-type">last</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486231"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486231"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">last</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">x</span><span class="hs-special">]</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">x</span><span>
</span><span id="line-127"></span><span class="hs-identifier">last</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">_</span><span class="hs-glyph">:</span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">last</span><span> </span><span class="hs-identifier">xs</span><span>
</span><span id="line-128"></span><span class="hs-identifier">last</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">errorEmptyList</span><span> </span><span class="hs-string">&quot;last&quot;</span><span class="hs-cpp">
#else
</span><span class="hs-comment">-- Use foldl to make last a good consumer.</span><span>
</span><span id="line-131"></span><span class="hs-comment">-- This will compile to good code for the actual GHC.List.last.</span><span>
</span><span id="line-132"></span><span class="hs-comment">-- (At least as long it is eta-expanded, otherwise it does not, #10260.)</span><span>
</span><span id="line-133"></span><span id="last"><span class="annot"><span class="annottext">last :: forall a. [a] -&gt; a
</span><a href="GHC.List.html#last"><span class="hs-identifier hs-var hs-var">last</span></a></span></span><span> </span><span id="local-6989586621679486230"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486230"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679486229"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486229"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486229"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
forall a. a
</span><a href="GHC.List.html#lastError"><span class="hs-identifier hs-var">lastError</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486230"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-134"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#last"><span class="hs-pragma hs-type">last</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- The inline pragma is required to make GHC remember the implementation via</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- foldl.</span><span>
</span><span id="line-137"></span><span id="local-6989586621679486227"><span class="annot"><a href="GHC.List.html#lastError"><span class="hs-identifier hs-type">lastError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486227"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-138"></span><span id="lastError"><span class="annot"><span class="annottext">lastError :: forall a. a
</span><a href="GHC.List.html#lastError"><span class="hs-identifier hs-var hs-var">lastError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;last&quot;</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). Return all the elements of a list except the last one.</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- The list must be non-empty.</span><span>
</span><span id="line-143"></span><span class="hs-comment">--</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- &gt;&gt;&gt; init [1, 2, 3]</span><span>
</span><span id="line-145"></span><span class="hs-comment">-- [1,2]</span><span>
</span><span id="line-146"></span><span class="hs-comment">-- &gt;&gt;&gt; init [1]</span><span>
</span><span id="line-147"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-148"></span><span class="hs-comment">-- &gt;&gt;&gt; init []</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- Exception: Prelude.init: empty list</span><span>
</span><span id="line-150"></span><span id="local-6989586621679486226"><span class="annot"><a href="GHC.List.html#init"><span class="hs-identifier hs-type">init</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486226"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486226"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">init</span><span> </span><span class="hs-special">[</span><span class="hs-identifier">x</span><span class="hs-special">]</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-153"></span><span class="hs-identifier">init</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x</span><span class="hs-glyph">:</span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">x</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">init</span><span> </span><span class="hs-identifier">xs</span><span>
</span><span id="line-154"></span><span class="hs-identifier">init</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">errorEmptyList</span><span> </span><span class="hs-string">&quot;init&quot;</span><span class="hs-cpp">
#else
</span><span class="hs-comment">-- eliminate repeated cases</span><span>
</span><span id="line-157"></span><span id="init"><span class="annot"><span class="annottext">init :: forall a. [a] -&gt; [a]
</span><a href="GHC.List.html#init"><span class="hs-identifier hs-var hs-var">init</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; [a]
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;init&quot;</span></span><span>
</span><span id="line-158"></span><span class="annot"><a href="GHC.List.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486225"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486225"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486224"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486224"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="#local-6989586621679486223"><span class="hs-identifier hs-var">init'</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486225"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486224"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-159"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486223"><span class="annot"><span class="annottext">init' :: t -&gt; [t] -&gt; [t]
</span><a href="#local-6989586621679486223"><span class="hs-identifier hs-var hs-var">init'</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-160"></span><span>        </span><span class="annot"><a href="#local-6989586621679486223"><span class="hs-identifier hs-var">init'</span></a></span><span> </span><span id="local-6989586621679486222"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679486222"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486221"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679486221"><span class="hs-identifier hs-var">z</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486220"><span class="annot"><span class="annottext">[t]
</span><a href="#local-6989586621679486220"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679486222"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; [t] -&gt; [t]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; [t] -&gt; [t]
</span><a href="#local-6989586621679486223"><span class="hs-identifier hs-var">init'</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621679486221"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[t]
</span><a href="#local-6989586621679486220"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-163"></span><span class="hs-comment">-- | \(\mathcal{O}(1)\). Test whether a list is empty.</span><span>
</span><span id="line-164"></span><span class="hs-comment">--</span><span>
</span><span id="line-165"></span><span class="hs-comment">-- &gt;&gt;&gt; null []</span><span>
</span><span id="line-166"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-167"></span><span class="hs-comment">-- &gt;&gt;&gt; null [1]</span><span>
</span><span id="line-168"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-169"></span><span class="hs-comment">-- &gt;&gt;&gt; null [1..]</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-171"></span><span id="local-6989586621679486561"><span class="annot"><a href="GHC.List.html#null"><span class="hs-identifier hs-type">null</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486561"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span>
</span><span id="line-172"></span><span id="null"><span class="annot"><span class="annottext">null :: forall a. [a] -&gt; Bool
</span><a href="GHC.List.html#null"><span class="hs-identifier hs-var hs-var">null</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-173"></span><span class="annot"><a href="GHC.List.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'length' returns the length of a finite list as an</span><span>
</span><span id="line-176"></span><span class="hs-comment">-- 'Int'. It is an instance of the more general 'Data.List.genericLength', the</span><span>
</span><span id="line-177"></span><span class="hs-comment">-- result type of which may be any kind of number.</span><span>
</span><span id="line-178"></span><span class="hs-comment">--</span><span>
</span><span id="line-179"></span><span class="hs-comment">-- &gt;&gt;&gt; length []</span><span>
</span><span id="line-180"></span><span class="hs-comment">-- 0</span><span>
</span><span id="line-181"></span><span class="hs-comment">-- &gt;&gt;&gt; length ['a', 'b', 'c']</span><span>
</span><span id="line-182"></span><span class="hs-comment">-- 3</span><span>
</span><span id="line-183"></span><span class="hs-comment">-- &gt;&gt;&gt; length [1..]</span><span>
</span><span id="line-184"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-185"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-186"></span><span id="local-6989586621679486559"><span class="annot"><a href="GHC.List.html#length"><span class="hs-identifier hs-type">length</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486559"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span></span><span>
</span><span id="line-187"></span><span id="length"><span class="annot"><span class="annottext">length :: forall a. [a] -&gt; Int
</span><a href="GHC.List.html#length"><span class="hs-identifier hs-var hs-var">length</span></a></span></span><span> </span><span id="local-6989586621679486219"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486219"><span class="hs-identifier hs-var">xs</span></a></span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Int -&gt; Int
forall a. [a] -&gt; Int -&gt; Int
</span><a href="GHC.List.html#lenAcc"><span class="hs-identifier hs-var">lenAcc</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486219"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span><span id="local-6989586621679486557"><span class="annot"><a href="GHC.List.html#lenAcc"><span class="hs-identifier hs-type">lenAcc</span></a></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486557"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span></span><span>
</span><span id="line-190"></span><span id="lenAcc"><span class="annot"><span class="annottext">lenAcc :: forall a. [a] -&gt; Int -&gt; Int
</span><a href="GHC.List.html#lenAcc"><span class="hs-identifier hs-var hs-var">lenAcc</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span id="local-6989586621679486214"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486214"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486214"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-191"></span><span class="annot"><a href="GHC.List.html#lenAcc"><span class="hs-identifier hs-var">lenAcc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486213"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486213"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679486212"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486212"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Int -&gt; Int
forall a. [a] -&gt; Int -&gt; Int
</span><a href="GHC.List.html#lenAcc"><span class="hs-identifier hs-var">lenAcc</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486213"><span class="hs-identifier hs-var">ys</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486212"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-194"></span><span class="annot"><span class="hs-pragma">&quot;length&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486210"><span class="annot"><a href="#local-6989586621679486210"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486210"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="annot"><a href="GHC.List.html#lengthFB"><span class="hs-pragma hs-type">lengthFB</span></a></span><span> </span><span class="annot"><a href="GHC.List.html#idLength"><span class="hs-pragma hs-type">idLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486210"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><span class="hs-pragma">0</span></span><span>
</span><span id="line-195"></span><span class="annot"><span class="hs-pragma">&quot;lengthList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="annot"><a href="GHC.List.html#lengthFB"><span class="hs-pragma hs-type">lengthFB</span></a></span><span> </span><span class="annot"><a href="GHC.List.html#idLength"><span class="hs-pragma hs-type">idLength</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#lenAcc"><span class="hs-pragma hs-type">lenAcc</span></a></span><span>
</span><span id="line-196"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span class="hs-comment">-- The lambda form turns out to be necessary to make this inline</span><span>
</span><span id="line-199"></span><span class="hs-comment">-- when we need it to and give good performance.</span><span>
</span><span id="line-200"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#lengthFB"><span class="hs-pragma hs-type">lengthFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-201"></span><span id="local-6989586621679486554"><span class="annot"><a href="GHC.List.html#lengthFB"><span class="hs-identifier hs-type">lengthFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486554"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span></span><span>
</span><span id="line-202"></span><span id="lengthFB"><span class="annot"><span class="annottext">lengthFB :: forall x. x -&gt; (Int -&gt; Int) -&gt; Int -&gt; Int
</span><a href="GHC.List.html#lengthFB"><span class="hs-identifier hs-var hs-var">lengthFB</span></a></span></span><span> </span><span class="annot"><span class="annottext">x
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679486205"><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679486205"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679486204"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486204"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679486205"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486204"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#idLength"><span class="hs-pragma hs-type">idLength</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-205"></span><span class="annot"><a href="GHC.List.html#idLength"><span class="hs-identifier hs-type">idLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-206"></span><span id="idLength"><span class="annot"><span class="annottext">idLength :: Int -&gt; Int
</span><a href="GHC.List.html#idLength"><span class="hs-identifier hs-var hs-var">idLength</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
forall a. a -&gt; a
</span><a href="GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'filter', applied to a predicate and a list, returns</span><span>
</span><span id="line-209"></span><span class="hs-comment">-- the list of those elements that satisfy the predicate; i.e.,</span><span>
</span><span id="line-210"></span><span class="hs-comment">--</span><span>
</span><span id="line-211"></span><span class="hs-comment">-- &gt; filter p xs = [ x | x &lt;- xs, p x]</span><span>
</span><span id="line-212"></span><span class="hs-comment">--</span><span>
</span><span id="line-213"></span><span class="hs-comment">-- &gt;&gt;&gt; filter odd [1, 2, 3]</span><span>
</span><span id="line-214"></span><span class="hs-comment">-- [1,3]</span><span>
</span><span id="line-215"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#filter"><span class="hs-pragma hs-type">filter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-216"></span><span id="local-6989586621679486551"><span class="annot"><a href="GHC.List.html#filter"><span class="hs-identifier hs-type">filter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486551"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486551"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486551"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-217"></span><span id="filter"><span class="annot"><span class="annottext">filter :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#filter"><span class="hs-identifier hs-var hs-var">filter</span></a></span></span><span> </span><span id="local-6989586621679486202"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486202"><span class="hs-identifier hs-var">_pred</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-218"></span><span class="annot"><a href="GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span id="local-6989586621679486201"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486201"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486200"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486200"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486199"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486199"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-219"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486201"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486200"><span class="hs-identifier hs-var">x</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486200"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486201"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486199"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-220"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486201"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486199"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-pragma hs-type">filterFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-223"></span><span id="local-6989586621679486548"><span id="local-6989586621679486549"><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-identifier hs-type">filterFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486548"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486548"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486548"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486548"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-224"></span><span id="filterFB"><span class="annot"><span class="annottext">filterFB :: forall a b. (a -&gt; b -&gt; b) -&gt; (a -&gt; Bool) -&gt; a -&gt; b -&gt; b
</span><a href="GHC.List.html#filterFB"><span class="hs-identifier hs-var hs-var">filterFB</span></a></span></span><span> </span><span id="local-6989586621679486197"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486197"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486196"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486196"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679486195"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486195"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679486194"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486194"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486196"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486195"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486195"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486197"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486194"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-225"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486194"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-226"></span><span>
</span><span id="line-227"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-228"></span><span class="annot"><span class="hs-pragma">&quot;filter&quot;</span></span><span>     </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486193"><span class="annot"><a href="#local-6989586621679486193"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679486192"><span class="annot"><a href="#local-6989586621679486192"><span class="hs-pragma hs-var">xs</span></a></span></span><span class="hs-pragma">.</span><span>  </span><span class="annot"><a href="GHC.List.html#filter"><span class="hs-pragma hs-type">filter</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486193"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486192"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486191"><span class="annot"><a href="#local-6989586621679486191"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486190"><span class="annot"><a href="#local-6989586621679486190"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-pragma hs-type">filterFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486191"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486193"><span class="hs-pragma hs-type">p</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486190"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486192"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-229"></span><span class="annot"><span class="hs-pragma">&quot;filterList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>  </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486189"><span class="annot"><a href="#local-6989586621679486189"><span class="hs-pragma hs-var">p</span></a></span></span><span class="hs-pragma">.</span><span>     </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-pragma hs-type">filterFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486189"><span class="hs-pragma hs-type">p</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#filter"><span class="hs-pragma hs-type">filter</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486189"><span class="hs-pragma hs-type">p</span></a></span><span>
</span><span id="line-230"></span><span class="annot"><span class="hs-pragma">&quot;filterFB&quot;</span></span><span>        </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486188"><span class="annot"><a href="#local-6989586621679486188"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486187"><span class="annot"><a href="#local-6989586621679486187"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679486186"><span class="annot"><a href="#local-6989586621679486186"><span class="hs-pragma hs-var">q</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-pragma hs-type">filterFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-pragma hs-type">filterFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486188"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486187"><span class="hs-pragma hs-type">p</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486186"><span class="hs-pragma hs-type">q</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#filterFB"><span class="hs-pragma hs-type">filterFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486188"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486185"><span class="annot"><a href="#local-6989586621679486185"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486186"><span class="hs-pragma hs-type">q</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486185"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-pragma hs-type">&amp;&amp;</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486187"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486185"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-231"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span class="hs-comment">-- Note the filterFB rule, which has p and q the &quot;wrong way round&quot; in the RHS.</span><span>
</span><span id="line-234"></span><span class="hs-comment">--     filterFB (filterFB c p) q a b</span><span>
</span><span id="line-235"></span><span class="hs-comment">--   = if q a then filterFB c p a b else b</span><span>
</span><span id="line-236"></span><span class="hs-comment">--   = if q a then (if p a then c a b else b) else b</span><span>
</span><span id="line-237"></span><span class="hs-comment">--   = if q a &amp;&amp; p a then c a b else b</span><span>
</span><span id="line-238"></span><span class="hs-comment">--   = filterFB c (\x -&gt; q x &amp;&amp; p x) a b</span><span>
</span><span id="line-239"></span><span class="hs-comment">-- I originally wrote (\x -&gt; p x &amp;&amp; q x), which is wrong, and actually</span><span>
</span><span id="line-240"></span><span class="hs-comment">-- gave rise to a live bug report.  SLPJ.</span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span>
</span><span id="line-243"></span><span class="hs-comment">-- | 'foldl', applied to a binary operator, a starting value (typically</span><span>
</span><span id="line-244"></span><span class="hs-comment">-- the left-identity of the operator), and a list, reduces the list</span><span>
</span><span id="line-245"></span><span class="hs-comment">-- using the binary operator, from left to right:</span><span>
</span><span id="line-246"></span><span class="hs-comment">--</span><span>
</span><span id="line-247"></span><span class="hs-comment">-- &gt; foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn</span><span>
</span><span id="line-248"></span><span class="hs-comment">--</span><span>
</span><span id="line-249"></span><span class="hs-comment">-- The list must be finite.</span><span>
</span><span id="line-250"></span><span class="hs-comment">--</span><span>
</span><span id="line-251"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl (+) 0 [1..4]</span><span>
</span><span id="line-252"></span><span class="hs-comment">-- 10</span><span>
</span><span id="line-253"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl (+) 42 []</span><span>
</span><span id="line-254"></span><span class="hs-comment">-- 42</span><span>
</span><span id="line-255"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl (-) 100 [1..4]</span><span>
</span><span id="line-256"></span><span class="hs-comment">-- 90</span><span>
</span><span id="line-257"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl (\reversedString nextChar -&gt; nextChar : reversedString) &quot;foo&quot; ['a', 'b', 'c', 'd']</span><span>
</span><span id="line-258"></span><span class="hs-comment">-- &quot;dcbafoo&quot;</span><span>
</span><span id="line-259"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl (+) 0 [1..]</span><span>
</span><span id="line-260"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-261"></span><span class="annot"><a href="GHC.List.html#foldl"><span class="hs-identifier hs-type">foldl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679486565"><span class="annot"><a href="#local-6989586621679486565"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679486566"><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span></span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486565"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486565"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span>
</span><span id="line-262"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#foldl"><span class="hs-pragma hs-type">foldl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-263"></span><span id="foldl"><span class="annot"><span class="annottext">foldl :: forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl"><span class="hs-identifier hs-var hs-var">foldl</span></a></span></span><span> </span><span id="local-6989586621679486183"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486183"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679486182"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486182"><span class="hs-identifier hs-var">z0</span></a></span></span><span> </span><span id="local-6989586621679486181"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486181"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-264"></span><span>  </span><span class="annot"><span class="annottext">(a -&gt; (b -&gt; b) -&gt; b -&gt; b) -&gt; (b -&gt; b) -&gt; [a] -&gt; b -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679486180"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486180"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621679486565"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486179"><span class="annot"><span class="annottext">b -&gt; b
</span><a href="#local-6989586621679486179"><span class="hs-identifier hs-var">fn</span></a></span></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(b -&gt; b) -&gt; b -&gt; b
</span><a href="../../ghc-prim/src/GHC.Magic.html#oneShot"><span class="hs-identifier hs-var">oneShot</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679486178"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486178"><span class="hs-identifier hs-var">z</span></a></span></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b -&gt; b
</span><a href="#local-6989586621679486179"><span class="hs-identifier hs-var">fn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486183"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486178"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486180"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; b
forall a. a -&gt; a
</span><a href="GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486181"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486182"><span class="hs-identifier hs-var">z0</span></a></span><span>
</span><span id="line-265"></span><span>  </span><span class="hs-comment">-- See Note [Left folds via right fold]</span><span>
</span><span id="line-266"></span><span>
</span><span id="line-267"></span><span class="hs-comment">{-
Note [Left folds via right fold]

Implementing foldl et. al. via foldr is only a good idea if the compiler can
optimize the resulting code (eta-expand the recursive &quot;go&quot;). See #7994.
We hope that one of the two measure kick in:

   * Call Arity (-fcall-arity, enabled by default) eta-expands it if it can see
     all calls and determine that the arity is large.
   * The oneShot annotation gives a hint to the regular arity analysis that
     it may assume that the lambda is called at most once.
     See [One-shot lambdas] in CoreArity and especially [Eta expanding thunks]
     in CoreArity.

The oneShot annotations used in this module are correct, as we only use them in
arguments to foldr, where we know how the arguments are called.

Note [Inline FB functions]
~~~~~~~~~~~~~~~~~~~~~~~~~~
After fusion rules successfully fire, we are usually left with one or more calls
to list-producing functions abstracted over cons and nil. Here we call them
FB functions because their names usually end with 'FB'. It's a good idea to
inline FB functions because:

* They are higher-order functions and therefore benefit from inlining.

* When the final consumer is a left fold, inlining the FB functions is the only
  way to make arity expansion happen. See Note [Left fold via right fold].

For this reason we mark all FB functions INLINE [0]. The [0] phase-specifier
ensures that calls to FB functions can be written back to the original form
when no fusion happens.

Without these inline pragmas, the loop in perf/should_run/T13001 won't be
allocation-free. Also see #13001.
-}</span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-comment">-- | A strict version of 'foldl'.</span><span>
</span><span id="line-307"></span><span class="annot"><a href="GHC.List.html#foldl%27"><span class="hs-identifier hs-type">foldl'</span></a></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621679486177"><span class="annot"><a href="#local-6989586621679486177"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621679486176"><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486177"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486177"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span>
</span><span id="line-308"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#foldl%27"><span class="hs-pragma hs-type">foldl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-309"></span><span id="foldl%27"><span class="annot"><span class="annottext">foldl' :: forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl%27"><span class="hs-identifier hs-var hs-var">foldl'</span></a></span></span><span> </span><span id="local-6989586621679486175"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486175"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679486174"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486174"><span class="hs-identifier hs-var">z0</span></a></span></span><span> </span><span id="local-6989586621679486173"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486173"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-310"></span><span>  </span><span class="annot"><span class="annottext">(a -&gt; (b -&gt; b) -&gt; b -&gt; b) -&gt; (b -&gt; b) -&gt; [a] -&gt; b -&gt; b
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679486172"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486172"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621679486177"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486171"><span class="annot"><span class="annottext">b -&gt; b
</span><a href="#local-6989586621679486171"><span class="hs-identifier hs-var">fn</span></a></span></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(b -&gt; b) -&gt; b -&gt; b
</span><a href="../../ghc-prim/src/GHC.Magic.html#oneShot"><span class="hs-identifier hs-var">oneShot</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679486170"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486170"><span class="hs-identifier hs-var">z</span></a></span></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486170"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
</span><a href="../../ghc-prim/src/GHC.Prim.html#seq"><span class="hs-operator hs-var">`seq`</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; b
</span><a href="#local-6989586621679486171"><span class="hs-identifier hs-var">fn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486175"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486170"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486172"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; b
forall a. a -&gt; a
</span><a href="GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486176"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486173"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486174"><span class="hs-identifier hs-var">z0</span></a></span><span>
</span><span id="line-311"></span><span>  </span><span class="hs-comment">-- See Note [Left folds via right fold]</span><span>
</span><span id="line-312"></span><span>
</span><span id="line-313"></span><span class="hs-comment">-- | 'foldl1' is a variant of 'foldl' that has no starting value argument,</span><span>
</span><span id="line-314"></span><span class="hs-comment">-- and thus must be applied to non-empty lists. Note that unlike 'foldl', the accumulated value must be of the same type as the list elements.</span><span>
</span><span id="line-315"></span><span class="hs-comment">--</span><span>
</span><span id="line-316"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl1 (+) [1..4]</span><span>
</span><span id="line-317"></span><span class="hs-comment">-- 10</span><span>
</span><span id="line-318"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl1 (+) []</span><span>
</span><span id="line-319"></span><span class="hs-comment">-- Exception: Prelude.foldl1: empty list</span><span>
</span><span id="line-320"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl1 (-) [1..4]</span><span>
</span><span id="line-321"></span><span class="hs-comment">-- -8</span><span>
</span><span id="line-322"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl1 (&amp;&amp;) [True, False, True, True]</span><span>
</span><span id="line-323"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-324"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl1 (||) [False, False, True, True]</span><span>
</span><span id="line-325"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-326"></span><span class="hs-comment">-- &gt;&gt;&gt; foldl1 (+) [1..]</span><span>
</span><span id="line-327"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-328"></span><span id="local-6989586621679486536"><span class="annot"><a href="GHC.List.html#foldl1"><span class="hs-identifier hs-type">foldl1</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486536"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486536"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486536"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486536"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486536"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-329"></span><span id="foldl1"><span class="annot"><span class="annottext">foldl1 :: forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.List.html#foldl1"><span class="hs-identifier hs-var hs-var">foldl1</span></a></span></span><span> </span><span id="local-6989586621679486169"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486169"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486168"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486168"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486167"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486167"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486169"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486168"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486167"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-330"></span><span class="annot"><a href="GHC.List.html#foldl1"><span class="hs-identifier hs-var">foldl1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foldl1&quot;</span></span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span class="hs-comment">-- | A strict version of 'foldl1'.</span><span>
</span><span id="line-333"></span><span id="local-6989586621679486166"><span class="annot"><a href="GHC.List.html#foldl1%27"><span class="hs-identifier hs-type">foldl1'</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486166"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486166"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486166"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486166"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486166"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-334"></span><span id="foldl1%27"><span class="annot"><span class="annottext">foldl1' :: forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.List.html#foldl1%27"><span class="hs-identifier hs-var hs-var">foldl1'</span></a></span></span><span> </span><span id="local-6989586621679486165"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486165"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486164"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486164"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486163"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486163"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486165"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486164"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486163"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-335"></span><span class="annot"><a href="GHC.List.html#foldl1%27"><span class="hs-identifier hs-var">foldl1'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foldl1'&quot;</span></span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-338"></span><span class="hs-comment">-- List sum and product</span><span>
</span><span id="line-339"></span><span>
</span><span id="line-340"></span><span class="hs-comment">-- | The 'sum' function computes the sum of a finite list of numbers.</span><span>
</span><span id="line-341"></span><span class="hs-comment">--</span><span>
</span><span id="line-342"></span><span class="hs-comment">-- &gt;&gt;&gt; sum []</span><span>
</span><span id="line-343"></span><span class="hs-comment">-- 0</span><span>
</span><span id="line-344"></span><span class="hs-comment">-- &gt;&gt;&gt; sum [42]</span><span>
</span><span id="line-345"></span><span class="hs-comment">-- 42</span><span>
</span><span id="line-346"></span><span class="hs-comment">-- &gt;&gt;&gt; sum [1..10]</span><span>
</span><span id="line-347"></span><span class="hs-comment">-- 55</span><span>
</span><span id="line-348"></span><span class="hs-comment">-- &gt;&gt;&gt; sum [4.1, 2.0, 1.7]</span><span>
</span><span id="line-349"></span><span class="hs-comment">-- 7.8</span><span>
</span><span id="line-350"></span><span class="hs-comment">-- &gt;&gt;&gt; sum [1..]</span><span>
</span><span id="line-351"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-352"></span><span id="local-6989586621679486533"><span class="annot"><a href="GHC.List.html#sum"><span class="hs-identifier hs-type">sum</span></a></span><span>                     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486533"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486533"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486533"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-353"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#sum"><span class="hs-pragma hs-type">sum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-354"></span><span id="sum"><span class="annot"><span class="annottext">sum :: forall a. Num a =&gt; [a] -&gt; a
</span><a href="GHC.List.html#sum"><span class="hs-identifier hs-var hs-var">sum</span></a></span></span><span>                     </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2B"><span class="hs-operator hs-var">(+)</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span class="hs-comment">-- | The 'product' function computes the product of a finite list of numbers.</span><span>
</span><span id="line-357"></span><span class="hs-comment">--</span><span>
</span><span id="line-358"></span><span class="hs-comment">-- &gt;&gt;&gt; product []</span><span>
</span><span id="line-359"></span><span class="hs-comment">-- 1</span><span>
</span><span id="line-360"></span><span class="hs-comment">-- &gt;&gt;&gt; product [42]</span><span>
</span><span id="line-361"></span><span class="hs-comment">-- 42</span><span>
</span><span id="line-362"></span><span class="hs-comment">-- &gt;&gt;&gt; product [1..10]</span><span>
</span><span id="line-363"></span><span class="hs-comment">-- 3628800</span><span>
</span><span id="line-364"></span><span class="hs-comment">-- &gt;&gt;&gt; product [4.1, 2.0, 1.7]</span><span>
</span><span id="line-365"></span><span class="hs-comment">-- 13.939999999999998</span><span>
</span><span id="line-366"></span><span class="hs-comment">-- &gt;&gt;&gt; product [1..]</span><span>
</span><span id="line-367"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-368"></span><span id="local-6989586621679486159"><span class="annot"><a href="GHC.List.html#product"><span class="hs-identifier hs-type">product</span></a></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Num.html#Num"><span class="hs-identifier hs-type">Num</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486159"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486159"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486159"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-369"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#product"><span class="hs-pragma hs-type">product</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-370"></span><span id="product"><span class="annot"><span class="annottext">product :: forall a. Num a =&gt; [a] -&gt; a
</span><a href="GHC.List.html#product"><span class="hs-identifier hs-var hs-var">product</span></a></span></span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; a
forall a b. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.List.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#%2A"><span class="hs-operator hs-var">(*)</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'scanl' is similar to 'foldl', but returns a list of</span><span>
</span><span id="line-373"></span><span class="hs-comment">-- successive reduced values from the left:</span><span>
</span><span id="line-374"></span><span class="hs-comment">--</span><span>
</span><span id="line-375"></span><span class="hs-comment">-- &gt; scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]</span><span>
</span><span id="line-376"></span><span class="hs-comment">--</span><span>
</span><span id="line-377"></span><span class="hs-comment">-- Note that</span><span>
</span><span id="line-378"></span><span class="hs-comment">--</span><span>
</span><span id="line-379"></span><span class="hs-comment">-- &gt; last (scanl f z xs) == foldl f z xs</span><span>
</span><span id="line-380"></span><span class="hs-comment">--</span><span>
</span><span id="line-381"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl (+) 0 [1..4]</span><span>
</span><span id="line-382"></span><span class="hs-comment">-- [0,1,3,6,10]</span><span>
</span><span id="line-383"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl (+) 42 []</span><span>
</span><span id="line-384"></span><span class="hs-comment">-- [42]</span><span>
</span><span id="line-385"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl (-) 100 [1..4]</span><span>
</span><span id="line-386"></span><span class="hs-comment">-- [100,99,97,94,90]</span><span>
</span><span id="line-387"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl (\reversedString nextChar -&gt; nextChar : reversedString) &quot;foo&quot; ['a', 'b', 'c', 'd']</span><span>
</span><span id="line-388"></span><span class="hs-comment">-- [&quot;foo&quot;,&quot;afoo&quot;,&quot;bafoo&quot;,&quot;cbafoo&quot;,&quot;dcbafoo&quot;]</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl (+) 0 [1..]</span><span>
</span><span id="line-390"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span class="hs-comment">-- This peculiar arrangement is necessary to prevent scanl being rewritten in</span><span>
</span><span id="line-393"></span><span class="hs-comment">-- its own right-hand side.</span><span>
</span><span id="line-394"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#scanl"><span class="hs-pragma hs-type">scanl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-395"></span><span id="local-6989586621679486529"><span id="local-6989586621679486530"><span class="annot"><a href="GHC.List.html#scanl"><span class="hs-identifier hs-type">scanl</span></a></span><span>                   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486530"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486529"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486530"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486530"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486529"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486530"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-396"></span><span id="scanl"><span class="annot"><span class="annottext">scanl :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="GHC.List.html#scanl"><span class="hs-identifier hs-var hs-var">scanl</span></a></span></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="#local-6989586621679486154"><span class="hs-identifier hs-var">scanlGo</span></a></span><span>
</span><span id="line-397"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-398"></span><span>    </span><span id="local-6989586621679486152"><span id="local-6989586621679486153"><span class="annot"><a href="#local-6989586621679486154"><span class="hs-identifier hs-type">scanlGo</span></a></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486153"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486152"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486153"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486153"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486152"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486153"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-399"></span><span>    </span><span id="local-6989586621679486154"><span class="annot"><span class="annottext">scanlGo :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="#local-6989586621679486154"><span class="hs-identifier hs-var hs-var">scanlGo</span></a></span></span><span> </span><span id="local-6989586621679486151"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486151"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486150"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486150"><span class="hs-identifier hs-var">q</span></a></span></span><span> </span><span id="local-6989586621679486149"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486149"><span class="hs-identifier hs-var">ls</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486150"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486149"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-400"></span><span>                               </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-401"></span><span>                               </span><span id="local-6989586621679486148"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486148"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486147"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486147"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="#local-6989586621679486154"><span class="hs-identifier hs-var">scanlGo</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486151"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486151"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486150"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486148"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486147"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span class="hs-comment">-- Note [scanl rewrite rules]</span><span>
</span><span id="line-404"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-405"></span><span class="annot"><span class="hs-pragma">&quot;scanl&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486146"><span class="annot"><a href="#local-6989586621679486146"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486145"><span class="annot"><a href="#local-6989586621679486145"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679486144"><span class="annot"><a href="#local-6989586621679486144"><span class="hs-pragma hs-var">bs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#scanl"><span class="hs-pragma hs-type">scanl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486146"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486145"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486144"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-406"></span><span>  </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486143"><span class="annot"><a href="#local-6989586621679486143"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486142"><span class="annot"><a href="#local-6989586621679486142"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486145"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">`</span><span class="hs-pragma">c</span><span class="hs-pragma">`</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanlFB"><span class="hs-pragma hs-type">scanlFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486146"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486143"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#constScanl"><span class="hs-pragma hs-type">constScanl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486142"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486144"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486145"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-407"></span><span id="local-6989586621679486139"><span class="annot"><span class="hs-pragma">&quot;scanlList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486138"><span class="annot"><a href="#local-6989586621679486138"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679486137"><span class="annot"><a href="#local-6989586621679486137"><span class="hs-pragma hs-var">a</span></a></span></span><span class="hs-pragma">::</span><span class="annot"><a href="#local-6989586621679486139"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span> </span><span id="local-6989586621679486136"><span class="annot"><a href="#local-6989586621679486136"><span class="hs-pragma hs-var">bs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-408"></span><span>    </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanlFB"><span class="hs-pragma hs-type">scanlFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486138"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#constScanl"><span class="hs-pragma hs-type">constScanl</span></a></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486136"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486137"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#tail"><span class="hs-pragma hs-type">tail</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanl"><span class="hs-pragma hs-type">scanl</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486138"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486137"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486136"><span class="hs-pragma hs-type">bs</span></a></span><span class="hs-pragma">)</span></span><span>
</span><span id="line-409"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#scanlFB"><span class="hs-pragma hs-type">scanlFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-412"></span><span id="local-6989586621679486522"><span id="local-6989586621679486523"><span id="local-6989586621679486524"><span class="annot"><a href="GHC.List.html#scanlFB"><span class="hs-identifier hs-type">scanlFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486524"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486524"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486524"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486522"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486522"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486523"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486524"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486522"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486524"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486522"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-413"></span><span id="scanlFB"><span class="annot"><span class="annottext">scanlFB :: forall b a c.
(b -&gt; a -&gt; b) -&gt; (b -&gt; c -&gt; c) -&gt; a -&gt; (b -&gt; c) -&gt; b -&gt; c
</span><a href="GHC.List.html#scanlFB"><span class="hs-identifier hs-var hs-var">scanlFB</span></a></span></span><span> </span><span id="local-6989586621679486135"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486135"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486134"><span class="annot"><span class="annottext">b -&gt; c -&gt; c
</span><a href="#local-6989586621679486134"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679486133"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486133"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679486132"><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621679486132"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(b -&gt; c) -&gt; b -&gt; c
</span><a href="../../ghc-prim/src/GHC.Magic.html#oneShot"><span class="hs-identifier hs-var">oneShot</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679486131"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486131"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679486130"><span class="annot"><span class="annottext">b' :: b
</span><a href="#local-6989586621679486130"><span class="hs-identifier hs-var hs-var">b'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486135"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486131"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486133"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486130"><span class="hs-identifier hs-var">b'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; c -&gt; c
</span><a href="#local-6989586621679486134"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621679486132"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486130"><span class="hs-identifier hs-var">b'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-414"></span><span>  </span><span class="hs-comment">-- See Note [Left folds via right fold]</span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#constScanl"><span class="hs-pragma hs-type">constScanl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-417"></span><span id="local-6989586621679486517"><span id="local-6989586621679486518"><span class="annot"><a href="GHC.List.html#constScanl"><span class="hs-identifier hs-type">constScanl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486518"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486517"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486518"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-418"></span><span id="constScanl"><span class="annot"><span class="annottext">constScanl :: forall a b. a -&gt; b -&gt; a
</span><a href="GHC.List.html#constScanl"><span class="hs-identifier hs-var hs-var">constScanl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; a
forall a b. a -&gt; b -&gt; a
</span><a href="GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span>
</span><span id="line-419"></span><span>
</span><span id="line-420"></span><span>
</span><span id="line-421"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'scanl1' is a variant of 'scanl' that has no starting</span><span>
</span><span id="line-422"></span><span class="hs-comment">-- value argument:</span><span>
</span><span id="line-423"></span><span class="hs-comment">--</span><span>
</span><span id="line-424"></span><span class="hs-comment">-- &gt; scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]</span><span>
</span><span id="line-425"></span><span class="hs-comment">--</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl1 (+) [1..4]</span><span>
</span><span id="line-427"></span><span class="hs-comment">-- [1,3,6,10]</span><span>
</span><span id="line-428"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl1 (+) []</span><span>
</span><span id="line-429"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-430"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl1 (-) [1..4]</span><span>
</span><span id="line-431"></span><span class="hs-comment">-- [1,-1,-4,-8]</span><span>
</span><span id="line-432"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl1 (&amp;&amp;) [True, False, True, True]</span><span>
</span><span id="line-433"></span><span class="hs-comment">-- [True,False,False,False]</span><span>
</span><span id="line-434"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl1 (||) [False, False, True, True]</span><span>
</span><span id="line-435"></span><span class="hs-comment">-- [False,False,True,True]</span><span>
</span><span id="line-436"></span><span class="hs-comment">-- &gt;&gt;&gt; scanl1 (+) [1..]</span><span>
</span><span id="line-437"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-438"></span><span id="local-6989586621679486514"><span class="annot"><a href="GHC.List.html#scanl1"><span class="hs-identifier hs-type">scanl1</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486514"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486514"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486514"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486514"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486514"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-439"></span><span id="scanl1"><span class="annot"><span class="annottext">scanl1 :: forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#scanl1"><span class="hs-identifier hs-var hs-var">scanl1</span></a></span></span><span> </span><span id="local-6989586621679486128"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486128"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486127"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486127"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486126"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486126"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; a -&gt; [a] -&gt; [a]
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="GHC.List.html#scanl"><span class="hs-identifier hs-var">scanl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486128"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486127"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486126"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-440"></span><span class="annot"><a href="GHC.List.html#scanl1"><span class="hs-identifier hs-var">scanl1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). A strict version of 'scanl'.</span><span>
</span><span id="line-443"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#scanl%27"><span class="hs-pragma hs-type">scanl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-444"></span><span id="local-6989586621679486124"><span id="local-6989586621679486125"><span class="annot"><a href="GHC.List.html#scanl%27"><span class="hs-identifier hs-type">scanl'</span></a></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486125"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486124"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486125"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486125"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486124"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486125"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-445"></span><span class="hs-comment">-- This peculiar form is needed to prevent scanl' from being rewritten</span><span>
</span><span id="line-446"></span><span class="hs-comment">-- in its own right hand side.</span><span>
</span><span id="line-447"></span><span id="scanl%27"><span class="annot"><span class="annottext">scanl' :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="GHC.List.html#scanl%27"><span class="hs-identifier hs-var hs-var">scanl'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="#local-6989586621679486123"><span class="hs-identifier hs-var">scanlGo'</span></a></span><span>
</span><span id="line-448"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-449"></span><span>    </span><span id="local-6989586621679486121"><span id="local-6989586621679486122"><span class="annot"><a href="#local-6989586621679486123"><span class="hs-identifier hs-type">scanlGo'</span></a></span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486122"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486121"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486122"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486122"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486121"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486122"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-450"></span><span>    </span><span id="local-6989586621679486123"><span class="annot"><span class="annottext">scanlGo' :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="#local-6989586621679486123"><span class="hs-identifier hs-var hs-var">scanlGo'</span></a></span></span><span> </span><span id="local-6989586621679486120"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486120"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679486119"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486119"><span class="hs-identifier hs-var">q</span></a></span></span><span> </span><span id="local-6989586621679486118"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486118"><span class="hs-identifier hs-var">ls</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486119"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486118"><span class="hs-identifier hs-var">ls</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-451"></span><span>                            </span><span class="hs-special">[</span><span class="hs-special">]</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-452"></span><span>                            </span><span id="local-6989586621679486117"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486117"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486116"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486116"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="#local-6989586621679486123"><span class="hs-identifier hs-var">scanlGo'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486120"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486120"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486119"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486117"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486116"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span class="hs-comment">-- Note [scanl rewrite rules]</span><span>
</span><span id="line-455"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-456"></span><span class="annot"><span class="hs-pragma">&quot;scanl'&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486115"><span class="annot"><a href="#local-6989586621679486115"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486114"><span class="annot"><a href="#local-6989586621679486114"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679486113"><span class="annot"><a href="#local-6989586621679486113"><span class="hs-pragma hs-var">bs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#scanl%27"><span class="hs-pragma hs-type">scanl'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486115"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486114"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486113"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-457"></span><span>  </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486112"><span class="annot"><a href="#local-6989586621679486112"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486111"><span class="annot"><a href="#local-6989586621679486111"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486114"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">`</span><span class="hs-pragma">c</span><span class="hs-pragma">`</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanlFB%27"><span class="hs-pragma hs-type">scanlFB'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486115"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486112"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#flipSeqScanl%27"><span class="hs-pragma hs-type">flipSeqScanl'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486111"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486113"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486114"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-458"></span><span class="annot"><span class="hs-pragma">&quot;scanlList'&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486108"><span class="annot"><a href="#local-6989586621679486108"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486107"><span class="annot"><a href="#local-6989586621679486107"><span class="hs-pragma hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679486106"><span class="annot"><a href="#local-6989586621679486106"><span class="hs-pragma hs-var">bs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-459"></span><span>    </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanlFB%27"><span class="hs-pragma hs-type">scanlFB'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486108"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#flipSeqScanl%27"><span class="hs-pragma hs-type">flipSeqScanl'</span></a></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486106"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486107"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#tail"><span class="hs-pragma hs-type">tail</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanl%27"><span class="hs-pragma hs-type">scanl'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486108"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486107"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486106"><span class="hs-pragma hs-type">bs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-460"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-461"></span><span>
</span><span id="line-462"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#scanlFB%27"><span class="hs-pragma hs-type">scanlFB'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-463"></span><span id="local-6989586621679486103"><span id="local-6989586621679486104"><span id="local-6989586621679486105"><span class="annot"><a href="GHC.List.html#scanlFB%27"><span class="hs-identifier hs-type">scanlFB'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486105"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486104"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486105"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486105"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486103"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486103"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486104"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486105"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486103"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486105"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486103"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-464"></span><span id="scanlFB%27"><span class="annot"><span class="annottext">scanlFB' :: forall b a c.
(b -&gt; a -&gt; b) -&gt; (b -&gt; c -&gt; c) -&gt; a -&gt; (b -&gt; c) -&gt; b -&gt; c
</span><a href="GHC.List.html#scanlFB%27"><span class="hs-identifier hs-var hs-var">scanlFB'</span></a></span></span><span> </span><span id="local-6989586621679486102"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486102"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486101"><span class="annot"><span class="annottext">b -&gt; c -&gt; c
</span><a href="#local-6989586621679486101"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679486100"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486100"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679486099"><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621679486099"><span class="hs-identifier hs-var">g</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(b -&gt; c) -&gt; b -&gt; c
</span><a href="../../ghc-prim/src/GHC.Magic.html#oneShot"><span class="hs-identifier hs-var">oneShot</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679486098"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486098"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679486097"><span class="annot"><span class="annottext">b' :: b
</span><a href="#local-6989586621679486097"><span class="hs-identifier hs-var hs-var">b'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621679486102"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486098"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486100"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486097"><span class="hs-identifier hs-var">b'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; c -&gt; c
</span><a href="#local-6989586621679486101"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621679486099"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486097"><span class="hs-identifier hs-var">b'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-465"></span><span>  </span><span class="hs-comment">-- See Note [Left folds via right fold]</span><span>
</span><span id="line-466"></span><span>
</span><span id="line-467"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#flipSeqScanl%27"><span class="hs-pragma hs-type">flipSeqScanl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-468"></span><span id="local-6989586621679486095"><span id="local-6989586621679486096"><span class="annot"><a href="GHC.List.html#flipSeqScanl%27"><span class="hs-identifier hs-type">flipSeqScanl'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486096"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486095"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486096"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-469"></span><span id="flipSeqScanl%27"><span class="annot"><span class="annottext">flipSeqScanl' :: forall a b. a -&gt; b -&gt; a
</span><a href="GHC.List.html#flipSeqScanl%27"><span class="hs-identifier hs-var hs-var">flipSeqScanl'</span></a></span></span><span> </span><span id="local-6989586621679486094"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486094"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679486093"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486093"><span class="hs-identifier hs-var">_b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486094"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span class="hs-comment">{-
Note [scanl rewrite rules]
~~~~~~~~~~~~~~~~~~~~~~~~~~

In most cases, when we rewrite a form to one that can fuse, we try to rewrite it
back to the original form if it does not fuse. For scanl, we do something a
little different. In particular, we rewrite

scanl f a bs

to

build (\c n -&gt; a `c` foldr (scanlFB f c) (constScanl n) bs a)

When build is inlined, this becomes

a : foldr (scanlFB f (:)) (constScanl []) bs a

To rewrite this form back to scanl, we would need a rule that looked like

forall f a bs. a : foldr (scanlFB f (:)) (constScanl []) bs a = scanl f a bs

The problem with this rule is that it has (:) at its head. This would have the
effect of changing the way the inliner looks at (:), not only here but
everywhere.  In most cases, this makes no difference, but in some cases it
causes it to come to a different decision about whether to inline something.
Based on nofib benchmarks, this is bad for performance. Therefore, we instead
match on everything past the :, which is just the tail of scanl.
-}</span><span>
</span><span id="line-500"></span><span>
</span><span id="line-501"></span><span class="hs-comment">-- foldr, foldr1, scanr, and scanr1 are the right-to-left duals of the</span><span>
</span><span id="line-502"></span><span class="hs-comment">-- above functions.</span><span>
</span><span id="line-503"></span><span>
</span><span id="line-504"></span><span class="hs-comment">-- | 'foldr1' is a variant of 'foldr' that has no starting value argument,</span><span>
</span><span id="line-505"></span><span class="hs-comment">-- and thus must be applied to non-empty lists. Note that unlike 'foldr', the accumulated value must be of the same type as the list elements.</span><span>
</span><span id="line-506"></span><span class="hs-comment">--</span><span>
</span><span id="line-507"></span><span class="hs-comment">-- &gt;&gt;&gt; foldr1 (+) [1..4]</span><span>
</span><span id="line-508"></span><span class="hs-comment">-- 10</span><span>
</span><span id="line-509"></span><span class="hs-comment">-- &gt;&gt;&gt; foldr1 (+) []</span><span>
</span><span id="line-510"></span><span class="hs-comment">-- Exception: Prelude.foldr1: empty list</span><span>
</span><span id="line-511"></span><span class="hs-comment">-- &gt;&gt;&gt; foldr1 (-) [1..4]</span><span>
</span><span id="line-512"></span><span class="hs-comment">-- -2</span><span>
</span><span id="line-513"></span><span class="hs-comment">-- &gt;&gt;&gt; foldr1 (&amp;&amp;) [True, False, True, True]</span><span>
</span><span id="line-514"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-515"></span><span class="hs-comment">-- &gt;&gt;&gt; foldr1 (||) [False, False, True, True]</span><span>
</span><span id="line-516"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-517"></span><span class="hs-comment">-- &gt;&gt;&gt; force $ foldr1 (+) [1..]</span><span>
</span><span id="line-518"></span><span class="hs-comment">-- *** Exception: stack overflow</span><span>
</span><span id="line-519"></span><span id="local-6989586621679486092"><span class="annot"><a href="GHC.List.html#foldr1"><span class="hs-identifier hs-type">foldr1</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486092"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486092"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486092"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486092"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486092"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-520"></span><span id="foldr1"><span class="annot"><span class="annottext">foldr1 :: forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.List.html#foldr1"><span class="hs-identifier hs-var hs-var">foldr1</span></a></span></span><span> </span><span id="local-6989586621679486091"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486091"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; a
</span><a href="#local-6989586621679486090"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-521"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486090"><span class="annot"><span class="annottext">go :: [a] -&gt; a
</span><a href="#local-6989586621679486090"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621679486089"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486089"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486089"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-522"></span><span>        </span><span class="annot"><a href="#local-6989586621679486090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486088"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486088"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486087"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486087"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486091"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486088"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; a
</span><a href="#local-6989586621679486090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486087"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-523"></span><span>        </span><span class="annot"><a href="#local-6989586621679486090"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;foldr1&quot;</span></span><span>
</span><span id="line-524"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#foldr1"><span class="hs-pragma hs-type">foldr1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-525"></span><span>
</span><span id="line-526"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'scanr' is the right-to-left dual of 'scanl'. Note that the order of parameters on the accumulating function are reversed compared to 'scanl'.</span><span>
</span><span id="line-527"></span><span class="hs-comment">-- Also note that</span><span>
</span><span id="line-528"></span><span class="hs-comment">--</span><span>
</span><span id="line-529"></span><span class="hs-comment">-- &gt; head (scanr f z xs) == foldr f z xs.</span><span>
</span><span id="line-530"></span><span class="hs-comment">--</span><span>
</span><span id="line-531"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr (+) 0 [1..4]</span><span>
</span><span id="line-532"></span><span class="hs-comment">-- [10,9,7,4,0]</span><span>
</span><span id="line-533"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr (+) 42 []</span><span>
</span><span id="line-534"></span><span class="hs-comment">-- [42]</span><span>
</span><span id="line-535"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr (-) 100 [1..4]</span><span>
</span><span id="line-536"></span><span class="hs-comment">-- [98,-97,99,-96,100]</span><span>
</span><span id="line-537"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr (\nextChar reversedString -&gt; nextChar : reversedString) &quot;foo&quot; ['a', 'b', 'c', 'd']</span><span>
</span><span id="line-538"></span><span class="hs-comment">-- [&quot;abcdfoo&quot;,&quot;bcdfoo&quot;,&quot;cdfoo&quot;,&quot;dfoo&quot;,&quot;foo&quot;]</span><span>
</span><span id="line-539"></span><span class="hs-comment">-- &gt;&gt;&gt; force $ scanr (+) 0 [1..]</span><span>
</span><span id="line-540"></span><span class="hs-comment">-- *** Exception: stack overflow</span><span>
</span><span id="line-541"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#scanr"><span class="hs-pragma hs-type">scanr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-542"></span><span id="local-6989586621679486501"><span id="local-6989586621679486502"><span class="annot"><a href="GHC.List.html#scanr"><span class="hs-identifier hs-type">scanr</span></a></span><span>                   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486502"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486501"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486501"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486501"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486502"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486501"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-543"></span><span id="scanr"><span class="annot"><span class="annottext">scanr :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="GHC.List.html#scanr"><span class="hs-identifier hs-var hs-var">scanr</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679486086"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486086"><span class="hs-identifier hs-var">q0</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486086"><span class="hs-identifier hs-var">q0</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-544"></span><span class="annot"><a href="GHC.List.html#scanr"><span class="hs-identifier hs-var">scanr</span></a></span><span> </span><span id="local-6989586621679486085"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486085"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486084"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486084"><span class="hs-identifier hs-var">q0</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486083"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486083"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486082"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486082"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486085"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486083"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486081"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679486080"><span class="hs-identifier hs-var">qs</span></a></span><span>
</span><span id="line-545"></span><span>                           </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486080"><span class="annot"><span class="annottext">qs :: [b]
</span><a href="#local-6989586621679486080"><span class="hs-identifier hs-var">qs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679486081"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486081"><span class="hs-identifier hs-var">q</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; [b]
</span><a href="GHC.List.html#scanr"><span class="hs-identifier hs-var">scanr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486085"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486084"><span class="hs-identifier hs-var">q0</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486082"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-546"></span><span>
</span><span id="line-547"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#strictUncurryScanr"><span class="hs-pragma hs-type">strictUncurryScanr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-548"></span><span id="local-6989586621679486496"><span id="local-6989586621679486497"><span id="local-6989586621679486498"><span class="annot"><a href="GHC.List.html#strictUncurryScanr"><span class="hs-identifier hs-type">strictUncurryScanr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486498"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486497"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486496"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486498"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679486497"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486496"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-549"></span><span id="strictUncurryScanr"><span class="annot"><span class="annottext">strictUncurryScanr :: forall a b c. (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c
</span><a href="GHC.List.html#strictUncurryScanr"><span class="hs-identifier hs-var hs-var">strictUncurryScanr</span></a></span></span><span> </span><span id="local-6989586621679486078"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679486078"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486077"><span class="annot"><span class="annottext">(a, b)
</span><a href="#local-6989586621679486077"><span class="hs-identifier hs-var">pair</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(a, b)
</span><a href="#local-6989586621679486077"><span class="hs-identifier hs-var">pair</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-550"></span><span>                              </span><span class="hs-special">(</span><span id="local-6989586621679486076"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486076"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679486075"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486075"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679486078"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486076"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486075"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-551"></span><span>
</span><span id="line-552"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#scanrFB"><span class="hs-pragma hs-type">scanrFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-553"></span><span id="local-6989586621679486490"><span id="local-6989586621679486491"><span id="local-6989586621679486492"><span class="annot"><a href="GHC.List.html#scanrFB"><span class="hs-identifier hs-type">scanrFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486492"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486491"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486491"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486491"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486490"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486490"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486492"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486491"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679486490"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486491"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679486490"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-554"></span><span id="scanrFB"><span class="annot"><span class="annottext">scanrFB :: forall a b c.
(a -&gt; b -&gt; b) -&gt; (b -&gt; c -&gt; c) -&gt; a -&gt; (b, c) -&gt; (b, c)
</span><a href="GHC.List.html#scanrFB"><span class="hs-identifier hs-var hs-var">scanrFB</span></a></span></span><span> </span><span id="local-6989586621679486073"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486073"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486072"><span class="annot"><span class="annottext">b -&gt; c -&gt; c
</span><a href="#local-6989586621679486072"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679486071"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486071"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679486070"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486070"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679486069"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679486069"><span class="hs-identifier hs-var">est</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486073"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486071"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486070"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486070"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; c -&gt; c
</span><a href="#local-6989586621679486072"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679486069"><span class="hs-identifier hs-var">est</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-555"></span><span class="hs-comment">-- This lazy pattern match on the tuple is necessary to prevent</span><span>
</span><span id="line-556"></span><span class="hs-comment">-- an infinite loop when scanr receives a fusable infinite list,</span><span>
</span><span id="line-557"></span><span class="hs-comment">-- which was the reason for #16943.</span><span>
</span><span id="line-558"></span><span class="hs-comment">-- See Note [scanrFB and evaluation] below</span><span>
</span><span id="line-559"></span><span>
</span><span id="line-560"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-561"></span><span class="annot"><span class="hs-pragma">&quot;scanr&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486068"><span class="annot"><a href="#local-6989586621679486068"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486067"><span class="annot"><a href="#local-6989586621679486067"><span class="hs-pragma hs-var">q0</span></a></span></span><span> </span><span id="local-6989586621679486066"><span class="annot"><a href="#local-6989586621679486066"><span class="hs-pragma hs-var">ls</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#scanr"><span class="hs-pragma hs-type">scanr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486068"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486067"><span class="hs-pragma hs-type">q0</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486066"><span class="hs-pragma hs-type">ls</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-562"></span><span>  </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486065"><span class="annot"><a href="#local-6989586621679486065"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486064"><span class="annot"><a href="#local-6989586621679486064"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#strictUncurryScanr"><span class="hs-pragma hs-type">strictUncurryScanr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486065"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanrFB"><span class="hs-pragma hs-type">scanrFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486068"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486065"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679486067"><span class="hs-pragma hs-type">q0</span></a></span><span class="hs-pragma">,</span><span class="annot"><a href="#local-6989586621679486064"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486066"><span class="hs-pragma hs-type">ls</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-563"></span><span class="annot"><span class="hs-pragma">&quot;scanrList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486063"><span class="annot"><a href="#local-6989586621679486063"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486062"><span class="annot"><a href="#local-6989586621679486062"><span class="hs-pragma hs-var">q0</span></a></span></span><span> </span><span id="local-6989586621679486061"><span class="annot"><a href="#local-6989586621679486061"><span class="hs-pragma hs-var">ls</span></a></span></span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-564"></span><span>               </span><span class="annot"><a href="GHC.List.html#strictUncurryScanr"><span class="hs-pragma hs-type">strictUncurryScanr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#scanrFB"><span class="hs-pragma hs-type">scanrFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486063"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679486062"><span class="hs-pragma hs-type">q0</span></a></span><span class="hs-pragma">,</span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679486061"><span class="hs-pragma hs-type">ls</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-565"></span><span>                 </span><span class="annot"><a href="GHC.List.html#scanr"><span class="hs-pragma hs-type">scanr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486063"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486062"><span class="hs-pragma hs-type">q0</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486061"><span class="hs-pragma hs-type">ls</span></a></span><span>
</span><span id="line-566"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-567"></span><span>
</span><span id="line-568"></span><span class="hs-comment">{- Note [scanrFB and evaluation]
In a previous Version, the pattern match on the tuple in scanrFB used to be
strict. If scanr is called with a build expression, the following would happen:
The rule &quot;scanr&quot; would fire, and we obtain
    build (\c n -&gt; strictUncurryScanr c (foldr (scanrFB f c) (q0,n) (build g))))
The rule &quot;foldr/build&quot; now fires, and the second argument of strictUncurryScanr
will be the expression
    g (scanrFB f c) (q0,n)
which will be evaluated, thanks to strictUncurryScanr.
The type of (g :: (a -&gt; b -&gt; b) -&gt; b -&gt; b) allows us to apply parametricity:
Either the tuple is returned (trivial), or scanrFB is called:
    g (scanrFB f c) (q0,n) = scanrFB ... (g' (scanrFB f c) (q0,n))
Notice that thanks to the strictness of scanrFB, the expression
g' (scanrFB f c) (q0,n) gets evaluated as well. In particular, if g' is a
recursive case of g, parametricity applies again and we will again have a
possible call to scanrFB. In short, g (scanrFB f c) (q0,n) will end up being
completely evaluated. This is resource consuming for large lists and if the
recursion has no exit condition (and this will be the case in functions like
repeat or cycle), the program will crash (see #16943).
The solution: Don't make scanrFB strict in its last argument. Doing so will
remove the cause for the chain of evaluations, and all is well.
-}</span><span>
</span><span id="line-590"></span><span>
</span><span id="line-591"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'scanr1' is a variant of 'scanr' that has no starting</span><span>
</span><span id="line-592"></span><span class="hs-comment">-- value argument.</span><span>
</span><span id="line-593"></span><span class="hs-comment">--</span><span>
</span><span id="line-594"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr1 (+) [1..4]</span><span>
</span><span id="line-595"></span><span class="hs-comment">-- [10,9,7,4]</span><span>
</span><span id="line-596"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr1 (+) []</span><span>
</span><span id="line-597"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-598"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr1 (-) [1..4]</span><span>
</span><span id="line-599"></span><span class="hs-comment">-- [-2,3,-1,4]</span><span>
</span><span id="line-600"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr1 (&amp;&amp;) [True, False, True, True]</span><span>
</span><span id="line-601"></span><span class="hs-comment">-- [False,False,True,True]</span><span>
</span><span id="line-602"></span><span class="hs-comment">-- &gt;&gt;&gt; scanr1 (||) [True, True, False, False]</span><span>
</span><span id="line-603"></span><span class="hs-comment">-- [True,True,False,False]</span><span>
</span><span id="line-604"></span><span class="hs-comment">-- &gt;&gt;&gt; force $ scanr1 (+) [1..]</span><span>
</span><span id="line-605"></span><span class="hs-comment">-- *** Exception: stack overflow</span><span>
</span><span id="line-606"></span><span id="local-6989586621679486060"><span class="annot"><a href="GHC.List.html#scanr1"><span class="hs-identifier hs-type">scanr1</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486060"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486060"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486060"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486060"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486060"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-607"></span><span id="scanr1"><span class="annot"><span class="annottext">scanr1 :: forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#scanr1"><span class="hs-identifier hs-var hs-var">scanr1</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-608"></span><span class="annot"><a href="GHC.List.html#scanr1"><span class="hs-identifier hs-var">scanr1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621679486059"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486059"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486059"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-609"></span><span class="annot"><a href="GHC.List.html#scanr1"><span class="hs-identifier hs-var">scanr1</span></a></span><span> </span><span id="local-6989586621679486058"><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486058"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679486057"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486057"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679486056"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486056"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486058"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486057"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486055"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486054"><span class="hs-identifier hs-var">qs</span></a></span><span>
</span><span id="line-610"></span><span>                           </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486054"><span class="annot"><span class="annottext">qs :: [a]
</span><a href="#local-6989586621679486054"><span class="hs-identifier hs-var">qs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679486055"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486055"><span class="hs-identifier hs-var">q</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; [a] -&gt; [a]
forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#scanr1"><span class="hs-identifier hs-var">scanr1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
</span><a href="#local-6989586621679486058"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486056"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-611"></span><span>
</span><span id="line-612"></span><span class="hs-comment">-- | 'maximum' returns the maximum value from a list,</span><span>
</span><span id="line-613"></span><span class="hs-comment">-- which must be non-empty, finite, and of an ordered type.</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- It is a special case of 'Data.List.maximumBy', which allows the</span><span>
</span><span id="line-615"></span><span class="hs-comment">-- programmer to supply their own comparison function.</span><span>
</span><span id="line-616"></span><span class="hs-comment">--</span><span>
</span><span id="line-617"></span><span class="hs-comment">-- &gt;&gt;&gt; maximum []</span><span>
</span><span id="line-618"></span><span class="hs-comment">-- Exception: Prelude.maximum: empty list</span><span>
</span><span id="line-619"></span><span class="hs-comment">-- &gt;&gt;&gt; maximum [42]</span><span>
</span><span id="line-620"></span><span class="hs-comment">-- 42</span><span>
</span><span id="line-621"></span><span class="hs-comment">-- &gt;&gt;&gt; maximum [55, -12, 7, 0, -89]</span><span>
</span><span id="line-622"></span><span class="hs-comment">-- 55</span><span>
</span><span id="line-623"></span><span class="hs-comment">-- &gt;&gt;&gt; maximum [1..]</span><span>
</span><span id="line-624"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-625"></span><span id="local-6989586621679486485"><span class="annot"><a href="GHC.List.html#maximum"><span class="hs-identifier hs-type">maximum</span></a></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486485"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486485"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486485"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-626"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.List.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-627"></span><span id="maximum"><span class="annot"><span class="annottext">maximum :: forall a. Ord a =&gt; [a] -&gt; a
</span><a href="GHC.List.html#maximum"><span class="hs-identifier hs-var hs-var">maximum</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;maximum&quot;</span></span><span>
</span><span id="line-628"></span><span class="annot"><a href="GHC.List.html#maximum"><span class="hs-identifier hs-var">maximum</span></a></span><span> </span><span id="local-6989586621679486051"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486051"><span class="hs-identifier hs-var">xs</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; [a] -&gt; a
forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.List.html#foldl1"><span class="hs-identifier hs-var">foldl1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#max"><span class="hs-identifier hs-var">max</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486051"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-629"></span><span>
</span><span id="line-630"></span><span class="hs-comment">-- We want this to be specialized so that with a strict max function, GHC</span><span>
</span><span id="line-631"></span><span class="hs-comment">-- produces good code. Note that to see if this is happending, one has to</span><span>
</span><span id="line-632"></span><span class="hs-comment">-- look at -ddump-prep, not -ddump-core!</span><span>
</span><span id="line-633"></span><span class="hs-pragma">{-# SPECIALIZE</span><span>  </span><span class="annot"><a href="GHC.List.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="hs-pragma">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-634"></span><span class="hs-pragma">{-# SPECIALIZE</span><span>  </span><span class="annot"><a href="GHC.List.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="hs-pragma">[</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-635"></span><span>
</span><span id="line-636"></span><span class="hs-comment">-- | 'minimum' returns the minimum value from a list,</span><span>
</span><span id="line-637"></span><span class="hs-comment">-- which must be non-empty, finite, and of an ordered type.</span><span>
</span><span id="line-638"></span><span class="hs-comment">-- It is a special case of 'Data.List.minimumBy', which allows the</span><span>
</span><span id="line-639"></span><span class="hs-comment">-- programmer to supply their own comparison function.</span><span>
</span><span id="line-640"></span><span class="hs-comment">--</span><span>
</span><span id="line-641"></span><span class="hs-comment">-- &gt;&gt;&gt; minimum []</span><span>
</span><span id="line-642"></span><span class="hs-comment">-- Exception: Prelude.minimum: empty list</span><span>
</span><span id="line-643"></span><span class="hs-comment">-- &gt;&gt;&gt; minimum [42]</span><span>
</span><span id="line-644"></span><span class="hs-comment">-- 42</span><span>
</span><span id="line-645"></span><span class="hs-comment">-- &gt;&gt;&gt; minimum [55, -12, 7, 0, -89]</span><span>
</span><span id="line-646"></span><span class="hs-comment">-- -89</span><span>
</span><span id="line-647"></span><span class="hs-comment">-- &gt;&gt;&gt; minimum [1..]</span><span>
</span><span id="line-648"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-649"></span><span id="local-6989586621679486049"><span class="annot"><a href="GHC.List.html#minimum"><span class="hs-identifier hs-type">minimum</span></a></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486049"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486049"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486049"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-650"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="annot"><a href="GHC.List.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-651"></span><span id="minimum"><span class="annot"><span class="annottext">minimum :: forall a. Ord a =&gt; [a] -&gt; a
</span><a href="GHC.List.html#minimum"><span class="hs-identifier hs-var hs-var">minimum</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;minimum&quot;</span></span><span>
</span><span id="line-652"></span><span class="annot"><a href="GHC.List.html#minimum"><span class="hs-identifier hs-var">minimum</span></a></span><span> </span><span id="local-6989586621679486046"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486046"><span class="hs-identifier hs-var">xs</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; a -&gt; a) -&gt; [a] -&gt; a
forall a. (a -&gt; a -&gt; a) -&gt; [a] -&gt; a
</span><a href="GHC.List.html#foldl1"><span class="hs-identifier hs-var">foldl1</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><a href="../../ghc-prim/src/GHC.Classes.html#min"><span class="hs-identifier hs-var">min</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486046"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-653"></span><span>
</span><span id="line-654"></span><span class="hs-pragma">{-# SPECIALIZE</span><span>  </span><span class="annot"><a href="GHC.List.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="hs-pragma">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-pragma hs-type">Int</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-655"></span><span class="hs-pragma">{-# SPECIALIZE</span><span>  </span><span class="annot"><a href="GHC.List.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="hs-pragma">[</span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-bignum/src/GHC.Num.Integer.html#Integer"><span class="hs-pragma hs-type">Integer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-656"></span><span>
</span><span id="line-657"></span><span>
</span><span id="line-658"></span><span class="hs-comment">-- | 'iterate' @f x@ returns an infinite list of repeated applications</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- of @f@ to @x@:</span><span>
</span><span id="line-660"></span><span class="hs-comment">--</span><span>
</span><span id="line-661"></span><span class="hs-comment">-- &gt; iterate f x == [x, f x, f (f x), ...]</span><span>
</span><span id="line-662"></span><span class="hs-comment">--</span><span>
</span><span id="line-663"></span><span class="hs-comment">-- Note that 'iterate' is lazy, potentially leading to thunk build-up if</span><span>
</span><span id="line-664"></span><span class="hs-comment">-- the consumer doesn't force each iterate. See 'iterate'' for a strict</span><span>
</span><span id="line-665"></span><span class="hs-comment">-- variant of this function.</span><span>
</span><span id="line-666"></span><span class="hs-comment">--</span><span>
</span><span id="line-667"></span><span class="hs-comment">-- &gt;&gt;&gt; take 10 $ iterate not True</span><span>
</span><span id="line-668"></span><span class="hs-comment">-- [True,False,True,False...</span><span>
</span><span id="line-669"></span><span class="hs-comment">-- &gt;&gt;&gt; take 10 $ iterate (+3) 42</span><span>
</span><span id="line-670"></span><span class="hs-comment">-- [42,45,48,51,54,57,60,63...</span><span>
</span><span id="line-671"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#iterate"><span class="hs-pragma hs-type">iterate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-672"></span><span id="local-6989586621679486481"><span class="annot"><a href="GHC.List.html#iterate"><span class="hs-identifier hs-type">iterate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486481"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486481"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486481"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486481"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-673"></span><span id="iterate"><span class="annot"><span class="annottext">iterate :: forall a. (a -&gt; a) -&gt; a -&gt; [a]
</span><a href="GHC.List.html#iterate"><span class="hs-identifier hs-var hs-var">iterate</span></a></span></span><span> </span><span id="local-6989586621679486044"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486044"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486043"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486043"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486043"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; a -&gt; [a]
forall a. (a -&gt; a) -&gt; a -&gt; [a]
</span><a href="GHC.List.html#iterate"><span class="hs-identifier hs-var">iterate</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486044"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486044"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486043"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-674"></span><span>
</span><span id="line-675"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#iterateFB"><span class="hs-pragma hs-type">iterateFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-676"></span><span id="local-6989586621679486478"><span id="local-6989586621679486479"><span class="annot"><a href="GHC.List.html#iterateFB"><span class="hs-identifier hs-type">iterateFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486479"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486478"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486478"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486479"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486479"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486479"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486478"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-677"></span><span id="iterateFB"><span class="annot"><span class="annottext">iterateFB :: forall a b. (a -&gt; b -&gt; b) -&gt; (a -&gt; a) -&gt; a -&gt; b
</span><a href="GHC.List.html#iterateFB"><span class="hs-identifier hs-var hs-var">iterateFB</span></a></span></span><span> </span><span id="local-6989586621679486041"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486041"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486040"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486040"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486039"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486039"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679486038"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486039"><span class="hs-identifier hs-var">x0</span></a></span><span>
</span><span id="line-678"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486038"><span class="annot"><span class="annottext">go :: a -&gt; b
</span><a href="#local-6989586621679486038"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679486037"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486037"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486037"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486041"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679486038"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486040"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486037"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-679"></span><span>
</span><span id="line-680"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-681"></span><span class="annot"><span class="hs-pragma">&quot;iterate&quot;</span></span><span>    </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486036"><span class="annot"><a href="#local-6989586621679486036"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486035"><span class="annot"><a href="#local-6989586621679486035"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span>   </span><span class="annot"><a href="GHC.List.html#iterate"><span class="hs-pragma hs-type">iterate</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486036"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486035"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486034"><span class="annot"><a href="#local-6989586621679486034"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486033"><span class="annot"><a href="#local-6989586621679486033"><span class="hs-pragma hs-var">_n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#iterateFB"><span class="hs-pragma hs-type">iterateFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486034"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486036"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486035"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-682"></span><span class="annot"><span class="hs-pragma">&quot;iterateFB&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>                </span><span class="annot"><a href="GHC.List.html#iterateFB"><span class="hs-pragma hs-type">iterateFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#iterate"><span class="hs-pragma hs-type">iterate</span></a></span><span>
</span><span id="line-683"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-684"></span><span>
</span><span id="line-685"></span><span>
</span><span id="line-686"></span><span class="hs-comment">-- | 'iterate'' is the strict version of 'iterate'.</span><span>
</span><span id="line-687"></span><span class="hs-comment">--</span><span>
</span><span id="line-688"></span><span class="hs-comment">-- It forces the result of each application of the function to weak head normal</span><span>
</span><span id="line-689"></span><span class="hs-comment">-- form (WHNF)</span><span>
</span><span id="line-690"></span><span class="hs-comment">-- before proceeding.</span><span>
</span><span id="line-691"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#iterate%27"><span class="hs-pragma hs-type">iterate'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-692"></span><span id="local-6989586621679486032"><span class="annot"><a href="GHC.List.html#iterate%27"><span class="hs-identifier hs-type">iterate'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486032"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486032"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486032"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486032"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-693"></span><span id="iterate%27"><span class="annot"><span class="annottext">iterate' :: forall a. (a -&gt; a) -&gt; a -&gt; [a]
</span><a href="GHC.List.html#iterate%27"><span class="hs-identifier hs-var hs-var">iterate'</span></a></span></span><span> </span><span id="local-6989586621679486031"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486031"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486030"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486030"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-694"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679486029"><span class="annot"><span class="annottext">x' :: a
</span><a href="#local-6989586621679486029"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486031"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486030"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-695"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486029"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Prim.html#seq"><span class="hs-operator hs-var">`seq`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486030"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; a) -&gt; a -&gt; [a]
forall a. (a -&gt; a) -&gt; a -&gt; [a]
</span><a href="GHC.List.html#iterate%27"><span class="hs-identifier hs-var">iterate'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486031"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486029"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-696"></span><span>
</span><span id="line-697"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#iterate%27FB"><span class="hs-pragma hs-type">iterate'FB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-698"></span><span id="local-6989586621679486026"><span id="local-6989586621679486027"><span class="annot"><a href="GHC.List.html#iterate%27FB"><span class="hs-identifier hs-type">iterate'FB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486026"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486026"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486027"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486027"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486026"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-699"></span><span id="iterate%27FB"><span class="annot"><span class="annottext">iterate'FB :: forall a b. (a -&gt; b -&gt; b) -&gt; (a -&gt; a) -&gt; a -&gt; b
</span><a href="GHC.List.html#iterate%27FB"><span class="hs-identifier hs-var hs-var">iterate'FB</span></a></span></span><span> </span><span id="local-6989586621679486025"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486025"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486024"><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486024"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486023"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486023"><span class="hs-identifier hs-var">x0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679486022"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486023"><span class="hs-identifier hs-var">x0</span></a></span><span>
</span><span id="line-700"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486022"><span class="annot"><span class="annottext">go :: a -&gt; b
</span><a href="#local-6989586621679486022"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679486021"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486021"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-701"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679486020"><span class="annot"><span class="annottext">x' :: a
</span><a href="#local-6989586621679486020"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; a
</span><a href="#local-6989586621679486024"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486021"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-702"></span><span>            </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486020"><span class="hs-identifier hs-var">x'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="../../ghc-prim/src/GHC.Prim.html#seq"><span class="hs-operator hs-var">`seq`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486021"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486025"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679486022"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486020"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-705"></span><span class="annot"><span class="hs-pragma">&quot;iterate'&quot;</span></span><span>    </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486019"><span class="annot"><a href="#local-6989586621679486019"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679486018"><span class="annot"><a href="#local-6989586621679486018"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span>   </span><span class="annot"><a href="GHC.List.html#iterate%27"><span class="hs-pragma hs-type">iterate'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486019"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486018"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486017"><span class="annot"><a href="#local-6989586621679486017"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486016"><span class="annot"><a href="#local-6989586621679486016"><span class="hs-pragma hs-var">_n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#iterate%27FB"><span class="hs-pragma hs-type">iterate'FB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486017"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486019"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486018"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-706"></span><span class="annot"><span class="hs-pragma">&quot;iterate'FB&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>                </span><span class="annot"><a href="GHC.List.html#iterate%27FB"><span class="hs-pragma hs-type">iterate'FB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#iterate%27"><span class="hs-pragma hs-type">iterate'</span></a></span><span>
</span><span id="line-707"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-708"></span><span>
</span><span id="line-709"></span><span>
</span><span id="line-710"></span><span class="hs-comment">-- | 'repeat' @x@ is an infinite list, with @x@ the value of every element.</span><span>
</span><span id="line-711"></span><span class="hs-comment">--</span><span>
</span><span id="line-712"></span><span class="hs-comment">-- &gt;&gt;&gt; take 20 $ repeat 17</span><span>
</span><span id="line-713"></span><span class="hs-comment">--[17,17,17,17,17,17,17,17,17...</span><span>
</span><span id="line-714"></span><span id="local-6989586621679486472"><span class="annot"><a href="GHC.List.html#repeat"><span class="hs-identifier hs-type">repeat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486472"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486472"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-715"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#repeat"><span class="hs-pragma hs-type">repeat</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-716"></span><span class="hs-comment">-- The pragma just gives the rules more chance to fire</span><span>
</span><span id="line-717"></span><span id="repeat"><span class="annot"><span class="annottext">repeat :: forall a. a -&gt; [a]
</span><a href="GHC.List.html#repeat"><span class="hs-identifier hs-var hs-var">repeat</span></a></span></span><span> </span><span id="local-6989586621679486015"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486015"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486014"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486014"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679486014"><span class="hs-identifier hs-var hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486015"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486014"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-718"></span><span>
</span><span id="line-719"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#repeatFB"><span class="hs-pragma hs-type">repeatFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>     </span><span class="hs-comment">-- ditto -- See Note [Inline FB functions]</span><span>
</span><span id="line-720"></span><span id="local-6989586621679486469"><span id="local-6989586621679486470"><span class="annot"><a href="GHC.List.html#repeatFB"><span class="hs-identifier hs-type">repeatFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486470"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486469"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486469"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486470"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486469"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-721"></span><span id="repeatFB"><span class="annot"><span class="annottext">repeatFB :: forall a b. (a -&gt; b -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.List.html#repeatFB"><span class="hs-identifier hs-var hs-var">repeatFB</span></a></span></span><span> </span><span id="local-6989586621679486012"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486012"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486011"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486011"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486010"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486010"><span class="annot"><span class="annottext">xs :: b
</span><a href="#local-6989586621679486010"><span class="hs-identifier hs-var hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486011"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679486012"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679486010"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-722"></span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-725"></span><span class="annot"><span class="hs-pragma">&quot;repeat&quot;</span></span><span>    </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679486009"><span class="annot"><a href="#local-6989586621679486009"><span class="hs-pragma hs-var">x</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#repeat"><span class="hs-pragma hs-type">repeat</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486009"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679486008"><span class="annot"><a href="#local-6989586621679486008"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679486007"><span class="annot"><a href="#local-6989586621679486007"><span class="hs-pragma hs-var">_n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#repeatFB"><span class="hs-pragma hs-type">repeatFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486008"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486009"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-726"></span><span class="annot"><span class="hs-pragma">&quot;repeatFB&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>  </span><span class="annot"><a href="GHC.List.html#repeatFB"><span class="hs-pragma hs-type">repeatFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span>       </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#repeat"><span class="hs-pragma hs-type">repeat</span></a></span><span>
</span><span id="line-727"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-728"></span><span>
</span><span id="line-729"></span><span class="hs-comment">-- | 'replicate' @n x@ is a list of length @n@ with @x@ the value of</span><span>
</span><span id="line-730"></span><span class="hs-comment">-- every element.</span><span>
</span><span id="line-731"></span><span class="hs-comment">-- It is an instance of the more general 'Data.List.genericReplicate',</span><span>
</span><span id="line-732"></span><span class="hs-comment">-- in which @n@ may be of any integral type.</span><span>
</span><span id="line-733"></span><span class="hs-comment">--</span><span>
</span><span id="line-734"></span><span class="hs-comment">-- &gt;&gt;&gt; replicate 0 True</span><span>
</span><span id="line-735"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-736"></span><span class="hs-comment">-- &gt;&gt;&gt; replicate (-1) True</span><span>
</span><span id="line-737"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-738"></span><span class="hs-comment">-- &gt;&gt;&gt; replicate 4 True</span><span>
</span><span id="line-739"></span><span class="hs-comment">-- [True,True,True,True]</span><span>
</span><span id="line-740"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#replicate"><span class="hs-pragma hs-type">replicate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-741"></span><span id="local-6989586621679486466"><span class="annot"><a href="GHC.List.html#replicate"><span class="hs-identifier hs-type">replicate</span></a></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486466"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486466"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-742"></span><span id="replicate"><span class="annot"><span class="annottext">replicate :: forall a. Int -&gt; a -&gt; [a]
</span><a href="GHC.List.html#replicate"><span class="hs-identifier hs-var hs-var">replicate</span></a></span></span><span> </span><span id="local-6989586621679486006"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486006"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679486005"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486005"><span class="hs-identifier hs-var">x</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [a]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679486006"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; [a]
forall a. a -&gt; [a]
</span><a href="GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679486005"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-743"></span><span>
</span><span id="line-744"></span><span class="hs-comment">-- | 'cycle' ties a finite list into a circular one, or equivalently,</span><span>
</span><span id="line-745"></span><span class="hs-comment">-- the infinite repetition of the original list.  It is the identity</span><span>
</span><span id="line-746"></span><span class="hs-comment">-- on infinite lists.</span><span>
</span><span id="line-747"></span><span class="hs-comment">--</span><span>
</span><span id="line-748"></span><span class="hs-comment">-- &gt;&gt;&gt; cycle []</span><span>
</span><span id="line-749"></span><span class="hs-comment">-- *** Exception: Prelude.cycle: empty list</span><span>
</span><span id="line-750"></span><span class="hs-comment">-- &gt;&gt;&gt; take 20 $ cycle [42]</span><span>
</span><span id="line-751"></span><span class="hs-comment">-- [42,42,42,42,42,42,42,42,42,42...</span><span>
</span><span id="line-752"></span><span class="hs-comment">-- &gt;&gt;&gt; take 20 $ cycle [2, 5, 7]</span><span>
</span><span id="line-753"></span><span class="hs-comment">-- [2,5,7,2,5,7,2,5,7,2,5,7...</span><span>
</span><span id="line-754"></span><span id="local-6989586621679486004"><span class="annot"><a href="GHC.List.html#cycle"><span class="hs-identifier hs-type">cycle</span></a></span><span>                   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486004"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486004"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-755"></span><span id="cycle"><span class="annot"><span class="annottext">cycle :: forall a. [a] -&gt; [a]
</span><a href="GHC.List.html#cycle"><span class="hs-identifier hs-var hs-var">cycle</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [a]
forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var">errorEmptyList</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;cycle&quot;</span></span><span>
</span><span id="line-756"></span><span class="annot"><a href="GHC.List.html#cycle"><span class="hs-identifier hs-var">cycle</span></a></span><span> </span><span id="local-6989586621679486003"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486003"><span class="hs-identifier hs-var">xs</span></a></span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486002"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679486002"><span class="annot"><span class="annottext">xs' :: [a]
</span><a href="#local-6989586621679486002"><span class="hs-identifier hs-var hs-var">xs'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486003"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679486002"><span class="hs-identifier hs-var">xs'</span></a></span><span>
</span><span id="line-757"></span><span>
</span><span id="line-758"></span><span class="hs-comment">-- | 'takeWhile', applied to a predicate @p@ and a list @xs@, returns the</span><span>
</span><span id="line-759"></span><span class="hs-comment">-- longest prefix (possibly empty) of @xs@ of elements that satisfy @p@.</span><span>
</span><span id="line-760"></span><span class="hs-comment">--</span><span>
</span><span id="line-761"></span><span class="hs-comment">-- &gt;&gt;&gt; takeWhile (&lt; 3) [1,2,3,4,1,2,3,4]</span><span>
</span><span id="line-762"></span><span class="hs-comment">-- [1,2]</span><span>
</span><span id="line-763"></span><span class="hs-comment">-- &gt;&gt;&gt; takeWhile (&lt; 9) [1,2,3]</span><span>
</span><span id="line-764"></span><span class="hs-comment">-- [1,2,3]</span><span>
</span><span id="line-765"></span><span class="hs-comment">-- &gt;&gt;&gt; takeWhile (&lt; 0) [1,2,3]</span><span>
</span><span id="line-766"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-767"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-768"></span><span id="local-6989586621679486001"><span class="annot"><a href="GHC.List.html#takeWhile"><span class="hs-identifier hs-type">takeWhile</span></a></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486001"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486001"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486001"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-769"></span><span id="takeWhile"><span class="annot"><span class="annottext">takeWhile :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#takeWhile"><span class="hs-identifier hs-var hs-var">takeWhile</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-770"></span><span class="annot"><a href="GHC.List.html#takeWhile"><span class="hs-identifier hs-var">takeWhile</span></a></span><span> </span><span id="local-6989586621679486000"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486000"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485999"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485999"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485998"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485998"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-771"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486000"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485999"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485999"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#takeWhile"><span class="hs-identifier hs-var">takeWhile</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679486000"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485998"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-772"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-pragma hs-type">takeWhileFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-775"></span><span id="local-6989586621679486459"><span id="local-6989586621679486460"><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-identifier hs-type">takeWhileFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486460"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486460"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486459"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486459"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486459"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486460"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486459"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486459"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-776"></span><span id="takeWhileFB"><span class="annot"><span class="annottext">takeWhileFB :: forall a b. (a -&gt; Bool) -&gt; (a -&gt; b -&gt; b) -&gt; b -&gt; a -&gt; b -&gt; b
</span><a href="GHC.List.html#takeWhileFB"><span class="hs-identifier hs-var hs-var">takeWhileFB</span></a></span></span><span> </span><span id="local-6989586621679485996"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485996"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679485995"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679485995"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485994"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485994"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679485993"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485993"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485992"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485992"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485996"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485993"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485993"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679485995"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485992"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485994"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-777"></span><span>
</span><span id="line-778"></span><span class="hs-comment">-- The takeWhileFB rule is similar to the filterFB rule. It works like this:</span><span>
</span><span id="line-779"></span><span class="hs-comment">-- takeWhileFB q (takeWhileFB p c n) n =</span><span>
</span><span id="line-780"></span><span class="hs-comment">-- \x r -&gt; if q x then (takeWhileFB p c n) x r else n =</span><span>
</span><span id="line-781"></span><span class="hs-comment">-- \x r -&gt; if q x then (\x' r' -&gt; if p x' then x' `c` r' else n) x r else n =</span><span>
</span><span id="line-782"></span><span class="hs-comment">-- \x r -&gt; if q x then (if p x then x `c` r else n) else n =</span><span>
</span><span id="line-783"></span><span class="hs-comment">-- \x r -&gt; if q x &amp;&amp; p x then x `c` r else n =</span><span>
</span><span id="line-784"></span><span class="hs-comment">-- takeWhileFB (\x -&gt; q x &amp;&amp; p x) c n</span><span>
</span><span id="line-785"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-786"></span><span class="annot"><span class="hs-pragma">&quot;takeWhile&quot;</span></span><span>     </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485991"><span class="annot"><a href="#local-6989586621679485991"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679485990"><span class="annot"><a href="#local-6989586621679485990"><span class="hs-pragma hs-var">xs</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485991"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485990"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-787"></span><span>                                </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485989"><span class="annot"><a href="#local-6989586621679485989"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485988"><span class="annot"><a href="#local-6989586621679485988"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-pragma hs-type">takeWhileFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485991"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485989"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485988"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485988"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485990"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-788"></span><span class="annot"><span class="hs-pragma">&quot;takeWhileList&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>  </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485987"><span class="annot"><a href="#local-6989586621679485987"><span class="hs-pragma hs-var">p</span></a></span></span><span class="hs-pragma">.</span><span>    </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-pragma hs-type">takeWhileFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485987"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485987"><span class="hs-pragma hs-type">p</span></a></span><span>
</span><span id="line-789"></span><span class="annot"><span class="hs-pragma">&quot;takeWhileFB&quot;</span></span><span>        </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485986"><span class="annot"><a href="#local-6989586621679485986"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485985"><span class="annot"><a href="#local-6989586621679485985"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485984"><span class="annot"><a href="#local-6989586621679485984"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679485983"><span class="annot"><a href="#local-6989586621679485983"><span class="hs-pragma hs-var">q</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-pragma hs-type">takeWhileFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485983"><span class="hs-pragma hs-type">q</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-pragma hs-type">takeWhileFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485984"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485986"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485985"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485985"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-790"></span><span>                        </span><span class="annot"><a href="GHC.List.html#takeWhileFB"><span class="hs-pragma hs-type">takeWhileFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485982"><span class="annot"><a href="#local-6989586621679485982"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485983"><span class="hs-pragma hs-type">q</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485982"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-pragma hs-type">&amp;&amp;</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485984"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485982"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485986"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485985"><span class="hs-pragma hs-type">n</span></a></span><span>
</span><span id="line-791"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-792"></span><span>
</span><span id="line-793"></span><span class="hs-comment">-- | 'dropWhile' @p xs@ returns the suffix remaining after 'takeWhile' @p xs@.</span><span>
</span><span id="line-794"></span><span class="hs-comment">--</span><span>
</span><span id="line-795"></span><span class="hs-comment">-- &gt;&gt;&gt; dropWhile (&lt; 3) [1,2,3,4,5,1,2,3]</span><span>
</span><span id="line-796"></span><span class="hs-comment">-- [3,4,5,1,2,3]</span><span>
</span><span id="line-797"></span><span class="hs-comment">-- &gt;&gt;&gt; dropWhile (&lt; 9) [1,2,3]</span><span>
</span><span id="line-798"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-799"></span><span class="hs-comment">-- &gt;&gt;&gt; dropWhile (&lt; 0) [1,2,3]</span><span>
</span><span id="line-800"></span><span class="hs-comment">-- [1,2,3]</span><span>
</span><span id="line-801"></span><span id="local-6989586621679485981"><span class="annot"><a href="GHC.List.html#dropWhile"><span class="hs-identifier hs-type">dropWhile</span></a></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679485981"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485981"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485981"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-802"></span><span id="dropWhile"><span class="annot"><span class="annottext">dropWhile :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#dropWhile"><span class="hs-identifier hs-var hs-var">dropWhile</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-803"></span><span class="annot"><a href="GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span id="local-6989586621679485980"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485980"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679485979"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679485979"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679485978"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485978"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485977"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485977"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-804"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485980"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485978"><span class="hs-identifier hs-var">x</span></a></span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485980"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485977"><span class="hs-identifier hs-var">xs'</span></a></span><span>
</span><span id="line-805"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485979"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-806"></span><span>
</span><span id="line-807"></span><span class="hs-comment">-- | 'take' @n@, applied to a list @xs@, returns the prefix of @xs@</span><span>
</span><span id="line-808"></span><span class="hs-comment">-- of length @n@, or @xs@ itself if @n &gt;= 'length' xs@.</span><span>
</span><span id="line-809"></span><span class="hs-comment">--</span><span>
</span><span id="line-810"></span><span class="hs-comment">-- &gt;&gt;&gt; take 5 &quot;Hello World!&quot;</span><span>
</span><span id="line-811"></span><span class="hs-comment">-- &quot;Hello&quot;</span><span>
</span><span id="line-812"></span><span class="hs-comment">-- &gt;&gt;&gt; take 3 [1,2,3,4,5]</span><span>
</span><span id="line-813"></span><span class="hs-comment">-- [1,2,3]</span><span>
</span><span id="line-814"></span><span class="hs-comment">-- &gt;&gt;&gt; take 3 [1,2]</span><span>
</span><span id="line-815"></span><span class="hs-comment">-- [1,2]</span><span>
</span><span id="line-816"></span><span class="hs-comment">-- &gt;&gt;&gt; take 3 []</span><span>
</span><span id="line-817"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-818"></span><span class="hs-comment">-- &gt;&gt;&gt; take (-1) [1,2]</span><span>
</span><span id="line-819"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-820"></span><span class="hs-comment">-- &gt;&gt;&gt; take 0 [1,2]</span><span>
</span><span id="line-821"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-822"></span><span class="hs-comment">--</span><span>
</span><span id="line-823"></span><span class="hs-comment">-- It is an instance of the more general 'Data.List.genericTake',</span><span>
</span><span id="line-824"></span><span class="hs-comment">-- in which @n@ may be of any integral type.</span><span>
</span><span id="line-825"></span><span id="local-6989586621679486464"><span class="annot"><a href="GHC.List.html#take"><span class="hs-identifier hs-type">take</span></a></span><span>                   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486464"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486464"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">take</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">_</span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-828"></span><span class="hs-identifier">take</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-829"></span><span class="hs-identifier">take</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">x</span><span class="hs-glyph">:</span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">x</span><span> </span><span class="hs-glyph">:</span><span> </span><span class="hs-identifier">take</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span class="hs-glyph">-</span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">xs</span><span class="hs-cpp">
#else
</span><span>
</span><span id="line-832"></span><span class="hs-comment">{- We always want to inline this to take advantage of a known length argument
sign. Note, however, that it's important for the RULES to grab take, rather
than trying to INLINE take immediately and then letting the RULES grab
unsafeTake. Presumably the latter approach doesn't grab it early enough; it led
to an allocation regression in nofib/fft2. -}</span><span>
</span><span id="line-837"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#take"><span class="hs-pragma hs-type">take</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-838"></span><span id="take"><span class="annot"><span class="annottext">take :: forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#take"><span class="hs-identifier hs-var hs-var">take</span></a></span></span><span> </span><span id="local-6989586621679485974"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485974"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485973"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485973"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485974"><span class="hs-identifier hs-var">n</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [a]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#unsafeTake"><span class="hs-identifier hs-var">unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485974"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485973"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-839"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-840"></span><span>
</span><span id="line-841"></span><span class="hs-comment">-- A version of take that takes the whole list if it's given an argument less</span><span>
</span><span id="line-842"></span><span class="hs-comment">-- than 1.</span><span>
</span><span id="line-843"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#unsafeTake"><span class="hs-pragma hs-type">unsafeTake</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-844"></span><span id="local-6989586621679485970"><span class="annot"><a href="GHC.List.html#unsafeTake"><span class="hs-identifier hs-type">unsafeTake</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485970"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485970"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-845"></span><span id="unsafeTake"><span class="annot"><span class="annottext">unsafeTake :: forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#unsafeTake"><span class="hs-identifier hs-var hs-var">unsafeTake</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-846"></span><span class="annot"><a href="GHC.List.html#unsafeTake"><span class="hs-identifier hs-var">unsafeTake</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621679485964"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485964"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485964"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-847"></span><span class="annot"><a href="GHC.List.html#unsafeTake"><span class="hs-identifier hs-var">unsafeTake</span></a></span><span> </span><span id="local-6989586621679485963"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485963"><span class="hs-identifier hs-var">m</span></a></span></span><span>   </span><span class="hs-special">(</span><span id="local-6989586621679485962"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485962"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485961"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485961"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485962"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [a]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#unsafeTake"><span class="hs-identifier hs-var">unsafeTake</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485963"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485961"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-848"></span><span>
</span><span id="line-849"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-850"></span><span class="annot"><span class="hs-pragma">&quot;take&quot;</span></span><span>     </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485960"><span class="annot"><a href="#local-6989586621679485960"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485959"><span class="annot"><a href="#local-6989586621679485959"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#take"><span class="hs-pragma hs-type">take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485960"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485959"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-851"></span><span>  </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485958"><span class="annot"><a href="#local-6989586621679485958"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485957"><span class="annot"><a href="#local-6989586621679485957"><span class="hs-pragma hs-var">nil</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">if</span><span> </span><span class="annot"><span class="hs-pragma">0</span></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-pragma hs-type">&lt;</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485960"><span class="hs-pragma hs-type">n</span></a></span><span>
</span><span id="line-852"></span><span>                   </span><span class="hs-pragma">then</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#takeFB"><span class="hs-pragma hs-type">takeFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485958"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485957"><span class="hs-pragma hs-type">nil</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#flipSeqTake"><span class="hs-pragma hs-type">flipSeqTake</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485957"><span class="hs-pragma hs-type">nil</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485959"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485960"><span class="hs-pragma hs-type">n</span></a></span><span>
</span><span id="line-853"></span><span>                   </span><span class="hs-pragma">else</span><span> </span><span class="annot"><a href="#local-6989586621679485957"><span class="hs-pragma hs-type">nil</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-854"></span><span class="annot"><span class="hs-pragma">&quot;unsafeTakeList&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485954"><span class="annot"><a href="#local-6989586621679485954"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485953"><span class="annot"><a href="#local-6989586621679485953"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#takeFB"><span class="hs-pragma hs-type">takeFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#flipSeqTake"><span class="hs-pragma hs-type">flipSeqTake</span></a></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485953"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485954"><span class="hs-pragma hs-type">n</span></a></span><span>
</span><span id="line-855"></span><span>                                        </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#unsafeTake"><span class="hs-pragma hs-type">unsafeTake</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485954"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485953"><span class="hs-pragma hs-type">xs</span></a></span><span>
</span><span id="line-856"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-857"></span><span>
</span><span id="line-858"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#flipSeqTake"><span class="hs-pragma hs-type">flipSeqTake</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-859"></span><span class="hs-comment">-- Just flip seq, specialized to Int, but not inlined too early.</span><span>
</span><span id="line-860"></span><span class="hs-comment">-- It's important to force the numeric argument here, even though</span><span>
</span><span id="line-861"></span><span class="hs-comment">-- it's not used. Otherwise, take n [] doesn't force n. This is</span><span>
</span><span id="line-862"></span><span class="hs-comment">-- bad for strictness analysis and unboxing, and leads to increased</span><span>
</span><span id="line-863"></span><span class="hs-comment">-- allocation in T7257.</span><span>
</span><span id="line-864"></span><span id="local-6989586621679486453"><span class="annot"><a href="GHC.List.html#flipSeqTake"><span class="hs-identifier hs-type">flipSeqTake</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679486453"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486453"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-865"></span><span id="flipSeqTake"><span class="annot"><span class="annottext">flipSeqTake :: forall a. a -&gt; Int -&gt; a
</span><a href="GHC.List.html#flipSeqTake"><span class="hs-identifier hs-var hs-var">flipSeqTake</span></a></span></span><span> </span><span id="local-6989586621679485952"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485952"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679485951"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485951"><span class="hs-identifier hs-var">_n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485952"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-866"></span><span>
</span><span id="line-867"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#takeFB"><span class="hs-pragma hs-type">takeFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-868"></span><span id="local-6989586621679486450"><span id="local-6989586621679486451"><span class="annot"><a href="GHC.List.html#takeFB"><span class="hs-identifier hs-type">takeFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486451"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486450"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486450"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486450"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486451"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486450"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486450"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-869"></span><span class="hs-comment">-- The \m accounts for the fact that takeFB is used in a higher-order</span><span>
</span><span id="line-870"></span><span class="hs-comment">-- way by takeFoldr, so it's better to inline.  A good example is</span><span>
</span><span id="line-871"></span><span class="hs-comment">--     take n (repeat x)</span><span>
</span><span id="line-872"></span><span class="hs-comment">-- for which we get excellent code... but only if we inline takeFB</span><span>
</span><span id="line-873"></span><span class="hs-comment">-- when given four arguments</span><span>
</span><span id="line-874"></span><span id="takeFB"><span class="annot"><span class="annottext">takeFB :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; a -&gt; (Int -&gt; b) -&gt; Int -&gt; b
</span><a href="GHC.List.html#takeFB"><span class="hs-identifier hs-var hs-var">takeFB</span></a></span></span><span> </span><span id="local-6989586621679485946"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679485946"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485945"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485945"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485944"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485944"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485943"><span class="annot"><span class="annottext">Int -&gt; b
</span><a href="#local-6989586621679485943"><span class="hs-identifier hs-var">xs</span></a></span></span><span>
</span><span id="line-875"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679485942"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485942"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485942"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-876"></span><span>            </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485944"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679485946"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485945"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-877"></span><span>            </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485944"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621679485946"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; b
</span><a href="#local-6989586621679485943"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485942"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-880"></span><span class="hs-comment">-- | 'drop' @n xs@ returns the suffix of @xs@</span><span>
</span><span id="line-881"></span><span class="hs-comment">-- after the first @n@ elements, or @[]@ if @n &gt;= 'length' xs@.</span><span>
</span><span id="line-882"></span><span class="hs-comment">--</span><span>
</span><span id="line-883"></span><span class="hs-comment">-- &gt;&gt;&gt; drop 6 &quot;Hello World!&quot;</span><span>
</span><span id="line-884"></span><span class="hs-comment">-- &quot;World!&quot;</span><span>
</span><span id="line-885"></span><span class="hs-comment">-- &gt;&gt;&gt; drop 3 [1,2,3,4,5]</span><span>
</span><span id="line-886"></span><span class="hs-comment">-- [4,5]</span><span>
</span><span id="line-887"></span><span class="hs-comment">-- &gt;&gt;&gt; drop 3 [1,2]</span><span>
</span><span id="line-888"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-889"></span><span class="hs-comment">-- &gt;&gt;&gt; drop 3 []</span><span>
</span><span id="line-890"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-891"></span><span class="hs-comment">-- &gt;&gt;&gt; drop (-1) [1,2]</span><span>
</span><span id="line-892"></span><span class="hs-comment">-- [1,2]</span><span>
</span><span id="line-893"></span><span class="hs-comment">-- &gt;&gt;&gt; drop 0 [1,2]</span><span>
</span><span id="line-894"></span><span class="hs-comment">-- [1,2]</span><span>
</span><span id="line-895"></span><span class="hs-comment">--</span><span>
</span><span id="line-896"></span><span class="hs-comment">-- It is an instance of the more general 'Data.List.genericDrop',</span><span>
</span><span id="line-897"></span><span class="hs-comment">-- in which @n@ may be of any integral type.</span><span>
</span><span id="line-898"></span><span id="local-6989586621679485941"><span class="annot"><a href="GHC.List.html#drop"><span class="hs-identifier hs-type">drop</span></a></span><span>                   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485941"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485941"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">drop</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">xs</span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">xs</span><span>
</span><span id="line-901"></span><span class="hs-identifier">drop</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-902"></span><span class="hs-identifier">drop</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">_</span><span class="hs-glyph">:</span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">drop</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span class="hs-glyph">-</span><span class="hs-number">1</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">xs</span><span class="hs-cpp">
#else /* hack away */
</span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#drop"><span class="hs-pragma hs-type">drop</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-905"></span><span id="drop"><span class="annot"><span class="annottext">drop :: forall a. Int -&gt; [a] -&gt; [a]
</span><a href="GHC.List.html#drop"><span class="hs-identifier hs-var hs-var">drop</span></a></span></span><span> </span><span id="local-6989586621679485938"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485938"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485937"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485937"><span class="hs-identifier hs-var">ls</span></a></span></span><span>
</span><span id="line-906"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485938"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485937"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-907"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [a]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679485935"><span class="hs-identifier hs-var">unsafeDrop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485938"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485937"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-908"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-909"></span><span>    </span><span class="hs-comment">-- A version of drop that drops the whole list if given an argument</span><span>
</span><span id="line-910"></span><span>    </span><span class="hs-comment">-- less than 1</span><span>
</span><span id="line-911"></span><span>    </span><span id="local-6989586621679485934"><span class="annot"><a href="#local-6989586621679485935"><span class="hs-identifier hs-type">unsafeDrop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485934"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485934"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-912"></span><span>    </span><span id="local-6989586621679485935"><span class="annot"><span class="annottext">unsafeDrop :: forall a. Int -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679485935"><span class="hs-identifier hs-var hs-var">unsafeDrop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-913"></span><span>    </span><span class="annot"><a href="#local-6989586621679485935"><span class="hs-identifier hs-var">unsafeDrop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485929"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485929"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485929"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-914"></span><span>    </span><span class="annot"><a href="#local-6989586621679485935"><span class="hs-identifier hs-var">unsafeDrop</span></a></span><span> </span><span id="local-6989586621679485928"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485928"><span class="hs-identifier hs-var">m</span></a></span></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485927"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485927"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; [a]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679485935"><span class="hs-identifier hs-var">unsafeDrop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485928"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485927"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-917"></span><span class="hs-comment">-- | 'splitAt' @n xs@ returns a tuple where first element is @xs@ prefix of</span><span>
</span><span id="line-918"></span><span class="hs-comment">-- length @n@ and second element is the remainder of the list:</span><span>
</span><span id="line-919"></span><span class="hs-comment">--</span><span>
</span><span id="line-920"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt 6 &quot;Hello World!&quot;</span><span>
</span><span id="line-921"></span><span class="hs-comment">-- (&quot;Hello &quot;,&quot;World!&quot;)</span><span>
</span><span id="line-922"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt 3 [1,2,3,4,5]</span><span>
</span><span id="line-923"></span><span class="hs-comment">-- ([1,2,3],[4,5])</span><span>
</span><span id="line-924"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt 1 [1,2,3]</span><span>
</span><span id="line-925"></span><span class="hs-comment">-- ([1],[2,3])</span><span>
</span><span id="line-926"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt 3 [1,2,3]</span><span>
</span><span id="line-927"></span><span class="hs-comment">-- ([1,2,3],[])</span><span>
</span><span id="line-928"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt 4 [1,2,3]</span><span>
</span><span id="line-929"></span><span class="hs-comment">-- ([1,2,3],[])</span><span>
</span><span id="line-930"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt 0 [1,2,3]</span><span>
</span><span id="line-931"></span><span class="hs-comment">-- ([],[1,2,3])</span><span>
</span><span id="line-932"></span><span class="hs-comment">-- &gt;&gt;&gt; splitAt (-1) [1,2,3]</span><span>
</span><span id="line-933"></span><span class="hs-comment">-- ([],[1,2,3])</span><span>
</span><span id="line-934"></span><span class="hs-comment">--</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- It is equivalent to @('take' n xs, 'drop' n xs)@ when @n@ is not @_|_@</span><span>
</span><span id="line-936"></span><span class="hs-comment">-- (@splitAt _|_ xs = _|_@).</span><span>
</span><span id="line-937"></span><span class="hs-comment">-- 'splitAt' is an instance of the more general 'Data.List.genericSplitAt',</span><span>
</span><span id="line-938"></span><span class="hs-comment">-- in which @n@ may be of any integral type.</span><span>
</span><span id="line-939"></span><span id="local-6989586621679486445"><span class="annot"><a href="GHC.List.html#splitAt"><span class="hs-identifier hs-type">splitAt</span></a></span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486445"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486445"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486445"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span class="hs-cpp">

#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">splitAt</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">xs</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-identifier">take</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">xs</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">drop</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span id="splitAt"><span class="annot"><span class="annottext">splitAt :: forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.List.html#splitAt"><span class="hs-identifier hs-var hs-var">splitAt</span></a></span></span><span> </span><span id="local-6989586621679485924"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485924"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679485923"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485923"><span class="hs-identifier hs-var">ls</span></a></span></span><span>
</span><span id="line-945"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485924"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485923"><span class="hs-identifier hs-var">ls</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-946"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; ([a], [a])
forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621679485922"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485924"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485923"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-947"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-948"></span><span>        </span><span id="local-6989586621679485921"><span class="annot"><a href="#local-6989586621679485922"><span class="hs-identifier hs-type">splitAt'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485921"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485921"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485921"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-949"></span><span>        </span><span id="local-6989586621679485922"><span class="annot"><span class="annottext">splitAt' :: forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621679485922"><span class="hs-identifier hs-var hs-var">splitAt'</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-950"></span><span>        </span><span class="annot"><a href="#local-6989586621679485922"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621679485918"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485918"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485917"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485917"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485918"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485917"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-951"></span><span>        </span><span class="annot"><a href="#local-6989586621679485922"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span id="local-6989586621679485916"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485916"><span class="hs-identifier hs-var">m</span></a></span></span><span>  </span><span class="hs-special">(</span><span id="local-6989586621679485915"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485915"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485914"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485914"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485915"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485913"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485912"><span class="hs-identifier hs-var">xs''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-952"></span><span>          </span><span class="hs-keyword">where</span><span>
</span><span id="line-953"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621679485913"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485913"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679485912"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485912"><span class="hs-identifier hs-var">xs''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [a] -&gt; ([a], [a])
forall a. Int -&gt; [a] -&gt; ([a], [a])
</span><a href="#local-6989586621679485922"><span class="hs-identifier hs-var">splitAt'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485916"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485914"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-cpp">
#endif /* USE_REPORT_PRELUDE */
</span><span>
</span><span id="line-956"></span><span class="hs-comment">-- | 'span', applied to a predicate @p@ and a list @xs@, returns a tuple where</span><span>
</span><span id="line-957"></span><span class="hs-comment">-- first element is longest prefix (possibly empty) of @xs@ of elements that</span><span>
</span><span id="line-958"></span><span class="hs-comment">-- satisfy @p@ and second element is the remainder of the list:</span><span>
</span><span id="line-959"></span><span class="hs-comment">--</span><span>
</span><span id="line-960"></span><span class="hs-comment">-- &gt;&gt;&gt; span (&lt; 3) [1,2,3,4,1,2,3,4]</span><span>
</span><span id="line-961"></span><span class="hs-comment">-- ([1,2],[3,4,1,2,3,4])</span><span>
</span><span id="line-962"></span><span class="hs-comment">-- &gt;&gt;&gt; span (&lt; 9) [1,2,3]</span><span>
</span><span id="line-963"></span><span class="hs-comment">-- ([1,2,3],[])</span><span>
</span><span id="line-964"></span><span class="hs-comment">-- &gt;&gt;&gt; span (&lt; 0) [1,2,3]</span><span>
</span><span id="line-965"></span><span class="hs-comment">-- ([],[1,2,3])</span><span>
</span><span id="line-966"></span><span class="hs-comment">--</span><span>
</span><span id="line-967"></span><span class="hs-comment">-- 'span' @p xs@ is equivalent to @('takeWhile' p xs, 'dropWhile' p xs)@</span><span>
</span><span id="line-968"></span><span id="local-6989586621679486442"><span class="annot"><a href="GHC.List.html#span"><span class="hs-identifier hs-type">span</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486442"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486442"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486442"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486442"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span>
</span><span id="line-969"></span><span id="span"><span class="annot"><span class="annottext">span :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.List.html#span"><span class="hs-identifier hs-var hs-var">span</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679485909"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679485909"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span class="hs-special">]</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485909"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485909"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-970"></span><span class="annot"><a href="GHC.List.html#span"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span id="local-6989586621679485908"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485908"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679485907"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679485907"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679485906"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485906"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485905"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485905"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-971"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485908"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485906"><span class="hs-identifier hs-var">x</span></a></span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485904"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485904"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485903"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485903"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.List.html#span"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485908"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485905"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485906"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485904"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485903"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-972"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485907"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-973"></span><span>
</span><span id="line-974"></span><span class="hs-comment">-- | 'break', applied to a predicate @p@ and a list @xs@, returns a tuple where</span><span>
</span><span id="line-975"></span><span class="hs-comment">-- first element is longest prefix (possibly empty) of @xs@ of elements that</span><span>
</span><span id="line-976"></span><span class="hs-comment">-- /do not satisfy/ @p@ and second element is the remainder of the list:</span><span>
</span><span id="line-977"></span><span class="hs-comment">--</span><span>
</span><span id="line-978"></span><span class="hs-comment">-- &gt;&gt;&gt; break (&gt; 3) [1,2,3,4,1,2,3,4]</span><span>
</span><span id="line-979"></span><span class="hs-comment">-- ([1,2,3],[4,1,2,3,4])</span><span>
</span><span id="line-980"></span><span class="hs-comment">-- &gt;&gt;&gt; break (&lt; 9) [1,2,3]</span><span>
</span><span id="line-981"></span><span class="hs-comment">-- ([],[1,2,3])</span><span>
</span><span id="line-982"></span><span class="hs-comment">-- &gt;&gt;&gt; break (&gt; 9) [1,2,3]</span><span>
</span><span id="line-983"></span><span class="hs-comment">-- ([1,2,3],[])</span><span>
</span><span id="line-984"></span><span class="hs-comment">--</span><span>
</span><span id="line-985"></span><span class="hs-comment">-- 'break' @p@ is equivalent to @'span' ('not' . p)@.</span><span>
</span><span id="line-986"></span><span id="local-6989586621679485902"><span class="annot"><a href="GHC.List.html#break"><span class="hs-identifier hs-type">break</span></a></span><span>                   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679485902"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485902"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485902"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485902"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">break</span><span> </span><span class="hs-identifier">p</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">span</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">not</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">p</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span class="hs-comment">-- HBC version (stolen)</span><span>
</span><span id="line-991"></span><span id="break"><span class="annot"><span class="annottext">break :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.List.html#break"><span class="hs-identifier hs-var hs-var">break</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679485901"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679485901"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">[</span><span class="hs-special">]</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485901"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485901"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-992"></span><span class="annot"><a href="GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span id="local-6989586621679485900"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485900"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679485899"><span class="annot"><span class="annottext">xs :: [a]
</span><a href="#local-6989586621679485899"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621679485898"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485898"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485897"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485897"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-993"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485900"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485898"><span class="hs-identifier hs-var">x</span></a></span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485899"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-994"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485896"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485896"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485895"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485895"><span class="hs-identifier hs-var">zs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.List.html#break"><span class="hs-identifier hs-var">break</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485900"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485897"><span class="hs-identifier hs-var">xs'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485898"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485896"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485895"><span class="hs-identifier hs-var">zs</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-997"></span><span class="hs-comment">-- | 'reverse' @xs@ returns the elements of @xs@ in reverse order.</span><span>
</span><span id="line-998"></span><span class="hs-comment">-- @xs@ must be finite.</span><span>
</span><span id="line-999"></span><span class="hs-comment">--</span><span>
</span><span id="line-1000"></span><span class="hs-comment">-- &gt;&gt;&gt; reverse []</span><span>
</span><span id="line-1001"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1002"></span><span class="hs-comment">-- &gt;&gt;&gt; reverse [42]</span><span>
</span><span id="line-1003"></span><span class="hs-comment">-- [42]</span><span>
</span><span id="line-1004"></span><span class="hs-comment">-- &gt;&gt;&gt; reverse [2,5,7]</span><span>
</span><span id="line-1005"></span><span class="hs-comment">-- [7,5,2]</span><span>
</span><span id="line-1006"></span><span class="hs-comment">-- &gt;&gt;&gt; reverse [1..]</span><span>
</span><span id="line-1007"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1008"></span><span id="local-6989586621679485894"><span class="annot"><a href="GHC.List.html#reverse"><span class="hs-identifier hs-type">reverse</span></a></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485894"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485894"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">reverse</span><span>                 </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">foldl</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">flip</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-cpp">
#else
</span><span id="reverse"><span class="annot"><span class="annottext">reverse :: forall a. [a] -&gt; [a]
</span><a href="GHC.List.html#reverse"><span class="hs-identifier hs-var hs-var">reverse</span></a></span></span><span> </span><span id="local-6989586621679485893"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485893"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679485892"><span class="hs-identifier hs-var">rev</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485893"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1013"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1014"></span><span>    </span><span id="local-6989586621679485892"><span class="annot"><span class="annottext">rev :: [a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679485892"><span class="hs-identifier hs-var hs-var">rev</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span id="local-6989586621679485891"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485891"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485891"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-1015"></span><span>    </span><span class="annot"><a href="#local-6989586621679485892"><span class="hs-identifier hs-var">rev</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485890"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485890"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485889"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485889"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679485888"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485888"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
</span><a href="#local-6989586621679485892"><span class="hs-identifier hs-var">rev</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485889"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485890"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485888"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1018"></span><span class="hs-comment">-- | 'and' returns the conjunction of a Boolean list. For the result to be</span><span>
</span><span id="line-1019"></span><span class="hs-comment">-- 'True', the list must be finite; 'False', however, results from a 'False'</span><span>
</span><span id="line-1020"></span><span class="hs-comment">-- value at a finite index of a finite or infinite list.</span><span>
</span><span id="line-1021"></span><span class="hs-comment">--</span><span>
</span><span id="line-1022"></span><span class="hs-comment">-- &gt;&gt;&gt; and []</span><span>
</span><span id="line-1023"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1024"></span><span class="hs-comment">-- &gt;&gt;&gt; and [True]</span><span>
</span><span id="line-1025"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1026"></span><span class="hs-comment">-- &gt;&gt;&gt; and [False]</span><span>
</span><span id="line-1027"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1028"></span><span class="hs-comment">-- &gt;&gt;&gt; and [True, True, False]</span><span>
</span><span id="line-1029"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1030"></span><span class="hs-comment">-- &gt;&gt;&gt; and (False : repeat True) -- Infinite list [False,True,True,True,True,True,True...</span><span>
</span><span id="line-1031"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1032"></span><span class="hs-comment">-- &gt;&gt;&gt; and (repeat True)</span><span>
</span><span id="line-1033"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1034"></span><span class="annot"><a href="GHC.List.html#and"><span class="hs-identifier hs-type">and</span></a></span><span>                     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">and</span><span>                     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">foldr</span><span> </span><span class="hs-special">(</span><span class="hs-operator">&amp;&amp;</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">True</span><span class="hs-cpp">
#else
</span><span id="and"><span class="annot"><span class="annottext">and :: [Bool] -&gt; Bool
</span><a href="GHC.List.html#and"><span class="hs-identifier hs-var hs-var">and</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-1039"></span><span class="annot"><a href="GHC.List.html#and"><span class="hs-identifier hs-var">and</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485887"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679485887"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485886"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621679485886"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679485887"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
</span><a href="GHC.List.html#and"><span class="hs-identifier hs-var">and</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621679485886"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1040"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#and"><span class="hs-pragma hs-type">and</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1041"></span><span>
</span><span id="line-1042"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1043"></span><span class="annot"><span class="hs-pragma">&quot;and/build&quot;</span></span><span>     </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485885"><span class="annot"><a href="#local-6989586621679485885"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485884"><span class="annot"><a href="#local-6989586621679485884"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-pragma hs-type">Bool</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485884"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485884"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485884"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485884"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-1044"></span><span>                </span><span class="annot"><a href="GHC.List.html#and"><span class="hs-pragma hs-type">and</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485885"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485885"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&amp;&amp;</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-pragma hs-type">True</span></a></span><span>
</span><span id="line-1045"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1048"></span><span class="hs-comment">-- | 'or' returns the disjunction of a Boolean list. For the result to be</span><span>
</span><span id="line-1049"></span><span class="hs-comment">-- 'False', the list must be finite; 'True', however, results from a 'True'</span><span>
</span><span id="line-1050"></span><span class="hs-comment">-- value at a finite index of a finite or infinite list.</span><span>
</span><span id="line-1051"></span><span class="hs-comment">--</span><span>
</span><span id="line-1052"></span><span class="hs-comment">-- &gt;&gt;&gt; or []</span><span>
</span><span id="line-1053"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1054"></span><span class="hs-comment">-- &gt;&gt;&gt; or [True]</span><span>
</span><span id="line-1055"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1056"></span><span class="hs-comment">-- &gt;&gt;&gt; or [False]</span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1058"></span><span class="hs-comment">-- &gt;&gt;&gt; or [True, True, False]</span><span>
</span><span id="line-1059"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1060"></span><span class="hs-comment">-- &gt;&gt;&gt; or (True : repeat False) -- Infinite list [True,False,False,False,False,False,False...</span><span>
</span><span id="line-1061"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1062"></span><span class="hs-comment">-- &gt;&gt;&gt; or (repeat False)</span><span>
</span><span id="line-1063"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1064"></span><span class="annot"><a href="GHC.List.html#or"><span class="hs-identifier hs-type">or</span></a></span><span>                      </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">or</span><span>                      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">foldr</span><span> </span><span class="hs-special">(</span><span class="hs-operator">||</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">False</span><span class="hs-cpp">
#else
</span><span id="or"><span class="annot"><span class="annottext">or :: [Bool] -&gt; Bool
</span><a href="GHC.List.html#or"><span class="hs-identifier hs-var hs-var">or</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-1069"></span><span class="annot"><a href="GHC.List.html#or"><span class="hs-identifier hs-var">or</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485883"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679485883"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485882"><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621679485882"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621679485883"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
</span><a href="GHC.List.html#or"><span class="hs-identifier hs-var">or</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621679485882"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1070"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#or"><span class="hs-pragma hs-type">or</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1071"></span><span>
</span><span id="line-1072"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1073"></span><span class="annot"><span class="hs-pragma">&quot;or/build&quot;</span></span><span>      </span><span class="hs-pragma">forall</span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485880"><span class="annot"><a href="#local-6989586621679485880"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485879"><span class="annot"><a href="#local-6989586621679485879"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-pragma hs-type">Bool</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485879"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485879"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485879"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485879"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-1074"></span><span>                </span><span class="annot"><a href="GHC.List.html#or"><span class="hs-pragma hs-type">or</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485880"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485880"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">||</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-pragma hs-type">False</span></a></span><span>
</span><span id="line-1075"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1078"></span><span class="hs-comment">-- | Applied to a predicate and a list, 'any' determines if any element</span><span>
</span><span id="line-1079"></span><span class="hs-comment">-- of the list satisfies the predicate. For the result to be</span><span>
</span><span id="line-1080"></span><span class="hs-comment">-- 'False', the list must be finite; 'True', however, results from a 'True'</span><span>
</span><span id="line-1081"></span><span class="hs-comment">-- value for the predicate applied to an element at a finite index of a finite</span><span>
</span><span id="line-1082"></span><span class="hs-comment">-- or infinite list.</span><span>
</span><span id="line-1083"></span><span class="hs-comment">--</span><span>
</span><span id="line-1084"></span><span class="hs-comment">-- &gt;&gt;&gt; any (&gt; 3) []</span><span>
</span><span id="line-1085"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1086"></span><span class="hs-comment">-- &gt;&gt;&gt; any (&gt; 3) [1,2]</span><span>
</span><span id="line-1087"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1088"></span><span class="hs-comment">-- &gt;&gt;&gt; any (&gt; 3) [1,2,3,4,5]</span><span>
</span><span id="line-1089"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1090"></span><span class="hs-comment">-- &gt;&gt;&gt; any (&gt; 3) [1..]</span><span>
</span><span id="line-1091"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1092"></span><span class="hs-comment">-- &gt;&gt;&gt; any (&gt; 3) [0, -1..]</span><span>
</span><span id="line-1093"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1094"></span><span id="local-6989586621679486437"><span class="annot"><a href="GHC.List.html#any"><span class="hs-identifier hs-type">any</span></a></span><span>                     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486437"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486437"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">any</span><span> </span><span class="hs-identifier">p</span><span>                   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">or</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">p</span><span class="hs-cpp">
#else
</span><span id="any"><span class="annot"><span class="annottext">any :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#any"><span class="hs-identifier hs-var hs-var">any</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-1099"></span><span class="annot"><a href="GHC.List.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span id="local-6989586621679485878"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485878"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485877"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485877"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485876"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485876"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485878"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485877"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; Bool
forall a. (a -&gt; Bool) -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485878"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485876"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1100"></span><span>
</span><span id="line-1101"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#any"><span class="hs-pragma hs-type">any</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1102"></span><span>
</span><span id="line-1103"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1104"></span><span id="local-6989586621679485875"><span class="annot"><span class="hs-pragma">&quot;any/build&quot;</span></span><span>     </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485874"><span class="annot"><a href="#local-6989586621679485874"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485873"><span class="annot"><a href="#local-6989586621679485873"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485872"><span class="annot"><a href="#local-6989586621679485872"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485875"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485872"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485872"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485872"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485872"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-1105"></span><span>                </span><span class="annot"><a href="GHC.List.html#any"><span class="hs-pragma hs-type">any</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485874"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485873"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485873"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">(</span><span class="hs-pragma">||</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="GHC.Base.html#."><span class="hs-pragma hs-type">.</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485874"><span class="hs-pragma hs-type">p</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-pragma hs-type">False</span></a></span></span><span>
</span><span id="line-1106"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1109"></span><span class="hs-comment">-- | Applied to a predicate and a list, 'all' determines if all elements</span><span>
</span><span id="line-1110"></span><span class="hs-comment">-- of the list satisfy the predicate. For the result to be</span><span>
</span><span id="line-1111"></span><span class="hs-comment">-- 'True', the list must be finite; 'False', however, results from a 'False'</span><span>
</span><span id="line-1112"></span><span class="hs-comment">-- value for the predicate applied to an element at a finite index of a finite</span><span>
</span><span id="line-1113"></span><span class="hs-comment">-- or infinite list.</span><span>
</span><span id="line-1114"></span><span class="hs-comment">--</span><span>
</span><span id="line-1115"></span><span class="hs-comment">-- &gt;&gt;&gt; all (&gt; 3) []</span><span>
</span><span id="line-1116"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1117"></span><span class="hs-comment">-- &gt;&gt;&gt; all (&gt; 3) [1,2]</span><span>
</span><span id="line-1118"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1119"></span><span class="hs-comment">-- &gt;&gt;&gt; all (&gt; 3) [1,2,3,4,5]</span><span>
</span><span id="line-1120"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1121"></span><span class="hs-comment">-- &gt;&gt;&gt; all (&gt; 3) [1..]</span><span>
</span><span id="line-1122"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1123"></span><span class="hs-comment">-- &gt;&gt;&gt; all (&gt; 3) [4..]</span><span>
</span><span id="line-1124"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1125"></span><span id="local-6989586621679485870"><span class="annot"><a href="GHC.List.html#all"><span class="hs-identifier hs-type">all</span></a></span><span>                     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679485870"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485870"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">all</span><span> </span><span class="hs-identifier">p</span><span>                   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">and</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">p</span><span class="hs-cpp">
#else
</span><span id="all"><span class="annot"><span class="annottext">all :: forall a. (a -&gt; Bool) -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#all"><span class="hs-identifier hs-var hs-var">all</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-1130"></span><span class="annot"><a href="GHC.List.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span id="local-6989586621679485869"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485869"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485868"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485868"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485867"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485867"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485869"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485868"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; Bool
forall a. (a -&gt; Bool) -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621679485869"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485867"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1131"></span><span>
</span><span id="line-1132"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#all"><span class="hs-pragma hs-type">all</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1133"></span><span>
</span><span id="line-1134"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1135"></span><span id="local-6989586621679485866"><span class="annot"><span class="hs-pragma">&quot;all/build&quot;</span></span><span>     </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485865"><span class="annot"><a href="#local-6989586621679485865"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485864"><span class="annot"><a href="#local-6989586621679485864"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485863"><span class="annot"><a href="#local-6989586621679485863"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485866"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485863"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485863"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485863"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485863"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-1136"></span><span>                </span><span class="annot"><a href="GHC.List.html#all"><span class="hs-pragma hs-type">all</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485865"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485864"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485864"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">(</span><span class="hs-pragma">&amp;&amp;</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="GHC.Base.html#."><span class="hs-pragma hs-type">.</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485865"><span class="hs-pragma hs-type">p</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-pragma hs-type">True</span></a></span></span><span>
</span><span id="line-1137"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1140"></span><span class="hs-comment">-- | 'elem' is the list membership predicate, usually written in infix form,</span><span>
</span><span id="line-1141"></span><span class="hs-comment">-- e.g., @x \`elem\` xs@.  For the result to be</span><span>
</span><span id="line-1142"></span><span class="hs-comment">-- 'False', the list must be finite; 'True', however, results from an element</span><span>
</span><span id="line-1143"></span><span class="hs-comment">-- equal to @x@ found at a finite index of a finite or infinite list.</span><span>
</span><span id="line-1144"></span><span class="hs-comment">--</span><span>
</span><span id="line-1145"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `elem` []</span><span>
</span><span id="line-1146"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1147"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `elem` [1,2]</span><span>
</span><span id="line-1148"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1149"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `elem` [1,2,3,4,5]</span><span>
</span><span id="line-1150"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1151"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `elem` [1..]</span><span>
</span><span id="line-1152"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1153"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `elem` [4..]</span><span>
</span><span id="line-1154"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1155"></span><span id="local-6989586621679486434"><span class="annot"><a href="GHC.List.html#elem"><span class="hs-identifier hs-type">elem</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486434"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486434"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486434"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">elem</span><span> </span><span class="hs-identifier">x</span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">any</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">x</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span id="elem"><span class="annot"><span class="annottext">elem :: forall a. Eq a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#elem"><span class="hs-identifier hs-var hs-var">elem</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-1160"></span><span class="annot"><a href="GHC.List.html#elem"><span class="hs-identifier hs-var">elem</span></a></span><span> </span><span id="local-6989586621679485859"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485859"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485858"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485858"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485857"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485857"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485859"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485858"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall a. Eq a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#elem"><span class="hs-identifier hs-var">elem</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485859"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485857"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1161"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#elem"><span class="hs-pragma hs-type">elem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1162"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1163"></span><span id="local-6989586621679485856"><span class="annot"><span class="hs-pragma">&quot;elem/build&quot;</span></span><span>    </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485855"><span class="annot"><a href="#local-6989586621679485855"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485854"><span class="annot"><a href="#local-6989586621679485854"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485853"><span class="annot"><a href="#local-6989586621679485853"><span class="hs-pragma hs-type">b</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485856"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485853"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485853"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485853"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485853"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1164"></span><span>   </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#elem"><span class="hs-pragma hs-type">elem</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485855"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485854"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485854"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span> </span><span id="local-6989586621679485852"><span class="annot"><a href="#local-6989586621679485852"><span class="hs-pragma hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679485851"><span class="annot"><a href="#local-6989586621679485851"><span class="hs-pragma hs-var">r</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485855"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-pragma hs-type">==</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485852"><span class="hs-pragma hs-type">y</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-pragma hs-type">||</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485851"><span class="hs-pragma hs-type">r</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-pragma hs-type">False</span></a></span></span><span>
</span><span id="line-1165"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1168"></span><span class="hs-comment">-- | 'notElem' is the negation of 'elem'.</span><span>
</span><span id="line-1169"></span><span class="hs-comment">--</span><span>
</span><span id="line-1170"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `notElem` []</span><span>
</span><span id="line-1171"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1172"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `notElem` [1,2]</span><span>
</span><span id="line-1173"></span><span class="hs-comment">-- True</span><span>
</span><span id="line-1174"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `notElem` [1,2,3,4,5]</span><span>
</span><span id="line-1175"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1176"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `notElem` [1..]</span><span>
</span><span id="line-1177"></span><span class="hs-comment">-- False</span><span>
</span><span id="line-1178"></span><span class="hs-comment">-- &gt;&gt;&gt; 3 `notElem` [4..]</span><span>
</span><span id="line-1179"></span><span class="hs-comment">-- * Hangs forever *</span><span>
</span><span id="line-1180"></span><span id="local-6989586621679485850"><span class="annot"><a href="GHC.List.html#notElem"><span class="hs-identifier hs-type">notElem</span></a></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485850"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485850"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679485850"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">notElem</span><span> </span><span class="hs-identifier">x</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">all</span><span> </span><span class="hs-special">(</span><span class="hs-operator">/=</span><span> </span><span class="hs-identifier">x</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span id="notElem"><span class="annot"><span class="annottext">notElem :: forall a. Eq a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#notElem"><span class="hs-identifier hs-var hs-var">notElem</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-1185"></span><span class="annot"><a href="GHC.List.html#notElem"><span class="hs-identifier hs-var">notElem</span></a></span><span> </span><span id="local-6989586621679485846"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485846"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485845"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485845"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485844"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485844"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485846"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485845"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; Bool
forall a. Eq a =&gt; a -&gt; [a] -&gt; Bool
</span><a href="GHC.List.html#notElem"><span class="hs-identifier hs-var">notElem</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485846"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485844"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1186"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#notElem"><span class="hs-pragma hs-type">notElem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1187"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1188"></span><span id="local-6989586621679485842"><span class="annot"><span class="hs-pragma">&quot;notElem/build&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485841"><span class="annot"><a href="#local-6989586621679485841"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485840"><span class="annot"><a href="#local-6989586621679485840"><span class="hs-pragma hs-var">g</span></a></span></span><span> </span><span class="hs-pragma">::</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485839"><span class="annot"><a href="#local-6989586621679485839"><span class="hs-pragma hs-type">b</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485842"><span class="hs-pragma hs-type">a</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485839"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485839"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485839"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485839"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1189"></span><span>   </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#notElem"><span class="hs-pragma hs-type">notElem</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485841"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485840"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485840"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span> </span><span id="local-6989586621679485838"><span class="annot"><a href="#local-6989586621679485838"><span class="hs-pragma hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679485837"><span class="annot"><a href="#local-6989586621679485837"><span class="hs-pragma hs-var">r</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485841"><span class="hs-pragma hs-type">x</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-pragma hs-type">/=</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485838"><span class="hs-pragma hs-type">y</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-pragma hs-type">&amp;&amp;</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485837"><span class="hs-pragma hs-type">r</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-pragma hs-type">True</span></a></span></span><span>
</span><span id="line-1190"></span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1193"></span><span class="hs-comment">-- | \(\mathcal{O}(n)\). 'lookup' @key assocs@ looks up a key in an association</span><span>
</span><span id="line-1194"></span><span class="hs-comment">-- list.</span><span>
</span><span id="line-1195"></span><span class="hs-comment">--</span><span>
</span><span id="line-1196"></span><span class="hs-comment">-- &gt;&gt;&gt; lookup 2 []</span><span>
</span><span id="line-1197"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-1198"></span><span class="hs-comment">-- &gt;&gt;&gt; lookup 2 [(1, &quot;first&quot;)]</span><span>
</span><span id="line-1199"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-1200"></span><span class="hs-comment">-- &gt;&gt;&gt; lookup 2 [(1, &quot;first&quot;), (2, &quot;second&quot;), (3, &quot;third&quot;)]</span><span>
</span><span id="line-1201"></span><span class="hs-comment">-- Just &quot;second&quot;</span><span>
</span><span id="line-1202"></span><span id="local-6989586621679486429"><span id="local-6989586621679486430"><span class="annot"><a href="GHC.List.html#lookup"><span class="hs-identifier hs-type">lookup</span></a></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486430"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486430"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486430"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486429"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679486429"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-1203"></span><span id="lookup"><span class="annot"><span class="annottext">lookup :: forall a b. Eq a =&gt; a -&gt; [(a, b)] -&gt; Maybe b
</span><a href="GHC.List.html#lookup"><span class="hs-identifier hs-var hs-var">lookup</span></a></span></span><span> </span><span id="local-6989586621679485833"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485833"><span class="hs-identifier hs-var">_key</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Maybe b
forall a. Maybe a
</span><a href="GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1204"></span><span class="annot"><a href="GHC.List.html#lookup"><span class="hs-identifier hs-var">lookup</span></a></span><span>  </span><span id="local-6989586621679485832"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485832"><span class="hs-identifier hs-var">key</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679485831"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485831"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485830"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485830"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485829"><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621679485829"><span class="hs-identifier hs-var">xys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1205"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485832"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485831"><span class="hs-identifier hs-var">x</span></a></span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">b -&gt; Maybe b
forall a. a -&gt; Maybe a
</span><a href="GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485830"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-1206"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">a -&gt; [(a, b)] -&gt; Maybe b
forall a b. Eq a =&gt; a -&gt; [(a, b)] -&gt; Maybe b
</span><a href="GHC.List.html#lookup"><span class="hs-identifier hs-var">lookup</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485832"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="annot"><span class="annottext">[(a, b)]
</span><a href="#local-6989586621679485829"><span class="hs-identifier hs-var">xys</span></a></span><span>
</span><span id="line-1207"></span><span>
</span><span id="line-1208"></span><span class="hs-comment">-- | Map a function returning a list over a list and concatenate the results.</span><span>
</span><span id="line-1209"></span><span class="hs-comment">-- 'concatMap' can be seen as the composition of 'concat' and 'map'.</span><span>
</span><span id="line-1210"></span><span class="hs-comment">--</span><span>
</span><span id="line-1211"></span><span class="hs-comment">-- &gt; concatMap f xs == (concat . map f) xs</span><span>
</span><span id="line-1212"></span><span class="hs-comment">--</span><span>
</span><span id="line-1213"></span><span class="hs-comment">-- &gt;&gt;&gt; concatMap (\i -&gt; [-i,i]) []</span><span>
</span><span id="line-1214"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1215"></span><span class="hs-comment">-- &gt;&gt;&gt; concatMap (\i -&gt; [-i,i]) [1,2,3]</span><span>
</span><span id="line-1216"></span><span class="hs-comment">-- [-1,1,-2,2,-3,3]</span><span>
</span><span id="line-1217"></span><span id="local-6989586621679486425"><span id="local-6989586621679486426"><span class="annot"><a href="GHC.List.html#concatMap"><span class="hs-identifier hs-type">concatMap</span></a></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486426"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486425"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486426"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486425"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-1218"></span><span id="concatMap"><span class="annot"><span class="annottext">concatMap :: forall a b. (a -&gt; [b]) -&gt; [a] -&gt; [b]
</span><a href="GHC.List.html#concatMap"><span class="hs-identifier hs-var hs-var">concatMap</span></a></span></span><span> </span><span id="local-6989586621679485828"><span class="annot"><span class="annottext">a -&gt; [b]
</span><a href="#local-6989586621679485828"><span class="hs-identifier hs-var">f</span></a></span></span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">(a -&gt; [b] -&gt; [b]) -&gt; [b] -&gt; [a] -&gt; [b]
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b] -&gt; [b] -&gt; [b]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">(++)</span></a></span><span> </span><span class="annot"><span class="annottext">([b] -&gt; [b] -&gt; [b]) -&gt; (a -&gt; [b]) -&gt; a -&gt; [b] -&gt; [b]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; [b]
</span><a href="#local-6989586621679485828"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1219"></span><span>
</span><span id="line-1220"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#concatMap"><span class="hs-pragma hs-type">concatMap</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1221"></span><span>
</span><span id="line-1222"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1223"></span><span class="annot"><span class="hs-pragma">&quot;concatMap&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485827"><span class="annot"><a href="#local-6989586621679485827"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679485826"><span class="annot"><a href="#local-6989586621679485826"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#concatMap"><span class="hs-pragma hs-type">concatMap</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485827"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485826"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1224"></span><span>    </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485825"><span class="annot"><a href="#local-6989586621679485825"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485824"><span class="annot"><a href="#local-6989586621679485824"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485823"><span class="annot"><a href="#local-6989586621679485823"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485822"><span class="annot"><a href="#local-6989586621679485822"><span class="hs-pragma hs-var">b</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485825"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485822"><span class="hs-pragma hs-type">b</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485827"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485823"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485824"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485826"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1225"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1226"></span><span>
</span><span id="line-1227"></span><span>
</span><span id="line-1228"></span><span class="hs-comment">-- | Concatenate a list of lists.</span><span>
</span><span id="line-1229"></span><span class="hs-comment">--</span><span>
</span><span id="line-1230"></span><span class="hs-comment">-- &gt;&gt;&gt; concat []</span><span>
</span><span id="line-1231"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1232"></span><span class="hs-comment">-- &gt;&gt;&gt; concat [[42]]</span><span>
</span><span id="line-1233"></span><span class="hs-comment">-- [42]</span><span>
</span><span id="line-1234"></span><span class="hs-comment">-- &gt;&gt;&gt; concat [[1,2,3], [4,5], [6], []]</span><span>
</span><span id="line-1235"></span><span class="hs-comment">-- [1,2,3,4,5,6]</span><span>
</span><span id="line-1236"></span><span id="local-6989586621679486419"><span class="annot"><a href="GHC.List.html#concat"><span class="hs-identifier hs-type">concat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486419"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486419"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-1237"></span><span id="concat"><span class="annot"><span class="annottext">concat :: forall a. [[a]] -&gt; [a]
</span><a href="GHC.List.html#concat"><span class="hs-identifier hs-var hs-var">concat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; [a] -&gt; [a]) -&gt; [a] -&gt; [[a]] -&gt; [a]
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [a] -&gt; [a]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">(++)</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1238"></span><span>
</span><span id="line-1239"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#concat"><span class="hs-pragma hs-type">concat</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1240"></span><span>
</span><span id="line-1241"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1242"></span><span>  </span><span class="annot"><span class="hs-pragma">&quot;concat&quot;</span></span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485821"><span class="annot"><a href="#local-6989586621679485821"><span class="hs-pragma hs-var">xs</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#concat"><span class="hs-pragma hs-type">concat</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485821"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="hs-pragma">=</span><span>
</span><span id="line-1243"></span><span>     </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485820"><span class="annot"><a href="#local-6989586621679485820"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485819"><span class="annot"><a href="#local-6989586621679485819"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485818"><span class="annot"><a href="#local-6989586621679485818"><span class="hs-pragma hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485817"><span class="annot"><a href="#local-6989586621679485817"><span class="hs-pragma hs-var">y</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485820"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485817"><span class="hs-pragma hs-type">y</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485818"><span class="hs-pragma hs-type">x</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485819"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485821"><span class="hs-pragma hs-type">xs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1244"></span><span class="hs-pragma">-- We don't bother to turn non-fusible applications of concat back into concat</span><span>
</span><span id="line-1245"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1246"></span><span>
</span><span id="line-1247"></span><span class="hs-comment">-- | List index (subscript) operator, starting from 0.</span><span>
</span><span id="line-1248"></span><span class="hs-comment">-- It is an instance of the more general 'Data.List.genericIndex',</span><span>
</span><span id="line-1249"></span><span class="hs-comment">-- which takes an index of any integral type.</span><span>
</span><span id="line-1250"></span><span class="hs-comment">--</span><span>
</span><span id="line-1251"></span><span class="hs-comment">-- &gt;&gt;&gt; ['a', 'b', 'c'] !! 0</span><span>
</span><span id="line-1252"></span><span class="hs-comment">-- 'a'</span><span>
</span><span id="line-1253"></span><span class="hs-comment">-- &gt;&gt;&gt; ['a', 'b', 'c'] !! 2</span><span>
</span><span id="line-1254"></span><span class="hs-comment">-- 'c'</span><span>
</span><span id="line-1255"></span><span class="hs-comment">-- &gt;&gt;&gt; ['a', 'b', 'c'] !! 3</span><span>
</span><span id="line-1256"></span><span class="hs-comment">-- Exception: Prelude.!!: index too large</span><span>
</span><span id="line-1257"></span><span class="hs-comment">-- &gt;&gt;&gt; ['a', 'b', 'c'] !! (-1)</span><span>
</span><span id="line-1258"></span><span class="hs-comment">-- Exception: Prelude.!!: negative index</span><span>
</span><span id="line-1259"></span><span id="local-6989586621679486409"><span class="annot"><a href="GHC.List.html#%21%21"><span class="hs-operator hs-type">(!!)</span></a></span><span>                    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486409"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486409"><span class="hs-identifier hs-type">a</span></a></span></span><span class="hs-cpp">
#if defined(USE_REPORT_PRELUDE)
</span><span class="hs-identifier">xs</span><span>     </span><span class="hs-operator">!!</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-operator">&lt;</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">errorWithoutStackTrace</span><span> </span><span class="hs-string">&quot;Prelude.!!: negative index&quot;</span><span>
</span><span id="line-1262"></span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-operator">!!</span><span> </span><span class="hs-identifier">_</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">errorWithoutStackTrace</span><span> </span><span class="hs-string">&quot;Prelude.!!: index too large&quot;</span><span>
</span><span id="line-1263"></span><span class="hs-special">(</span><span class="hs-identifier">x</span><span class="hs-glyph">:</span><span class="hs-identifier">_</span><span class="hs-special">)</span><span>  </span><span class="hs-operator">!!</span><span> </span><span class="hs-number">0</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">x</span><span>
</span><span id="line-1264"></span><span class="hs-special">(</span><span class="hs-identifier">_</span><span class="hs-glyph">:</span><span class="hs-identifier">xs</span><span class="hs-special">)</span><span> </span><span class="hs-operator">!!</span><span> </span><span class="hs-identifier">n</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">xs</span><span> </span><span class="hs-operator">!!</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">n</span><span class="hs-glyph">-</span><span class="hs-number">1</span><span class="hs-special">)</span><span class="hs-cpp">
#else
</span><span>
</span><span id="line-1267"></span><span class="hs-comment">-- We don't really want the errors to inline with (!!).</span><span>
</span><span id="line-1268"></span><span class="hs-comment">-- We may want to fuss around a bit with NOINLINE, and</span><span>
</span><span id="line-1269"></span><span class="hs-comment">-- if so we should be careful not to trip up known-bottom</span><span>
</span><span id="line-1270"></span><span class="hs-comment">-- optimizations.</span><span>
</span><span id="line-1271"></span><span id="local-6989586621679486417"><span class="annot"><a href="GHC.List.html#tooLarge"><span class="hs-identifier hs-type">tooLarge</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486417"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1272"></span><span id="tooLarge"><span class="annot"><span class="annottext">tooLarge :: forall a. Int -&gt; a
</span><a href="GHC.List.html#tooLarge"><span class="hs-identifier hs-var hs-var">tooLarge</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="GHC.List.html#prel_list_str"><span class="hs-identifier hs-var">prel_list_str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;!!: index too large&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1273"></span><span>
</span><span id="line-1274"></span><span id="local-6989586621679485813"><span class="annot"><a href="GHC.List.html#negIndex"><span class="hs-identifier hs-type">negIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679485813"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1275"></span><span id="negIndex"><span class="annot"><span class="annottext">negIndex :: forall a. a
</span><a href="GHC.List.html#negIndex"><span class="hs-identifier hs-var hs-var">negIndex</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; a) -&gt; String -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="GHC.List.html#prel_list_str"><span class="hs-identifier hs-var">prel_list_str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;!!: negative index&quot;</span></span><span>
</span><span id="line-1276"></span><span>
</span><span id="line-1277"></span><span class="hs-pragma">{-# INLINABLE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">!!</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1278"></span><span id="local-6989586621679485805"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485805"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span id="%21%21"><span class="annot"><span class="annottext">!! :: forall a. [a] -&gt; Int -&gt; a
</span><a href="GHC.List.html#%21%21"><span class="hs-operator hs-var hs-var">!!</span></a></span></span><span> </span><span id="local-6989586621679485804"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485804"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-1279"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485804"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
forall a. a
</span><a href="GHC.List.html#negIndex"><span class="hs-identifier hs-var">negIndex</span></a></span><span>
</span><span id="line-1280"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (Int -&gt; a) -&gt; Int -&gt; a) -&gt; (Int -&gt; a) -&gt; [a] -&gt; Int -&gt; a
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679485803"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485803"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485802"><span class="annot"><span class="annottext">Int -&gt; a
</span><a href="#local-6989586621679485802"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679485801"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485801"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485801"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1281"></span><span>                                   </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485803"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1282"></span><span>                                   </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
</span><a href="#local-6989586621679485802"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485801"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; a
forall a. Int -&gt; a
</span><a href="GHC.List.html#tooLarge"><span class="hs-identifier hs-var">tooLarge</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485805"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679485804"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-1285"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-1286"></span><span class="hs-comment">-- The zip family</span><span>
</span><span id="line-1287"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-1288"></span><span>
</span><span id="line-1289"></span><span id="local-6989586621679486405"><span id="local-6989586621679486406"><span id="local-6989586621679486407"><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-identifier hs-type">foldr2</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486407"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486406"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486405"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486405"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486405"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486407"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486406"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486405"><span class="hs-identifier hs-type">c</span></a></span></span></span></span><span>
</span><span id="line-1290"></span><span id="foldr2"><span class="annot"><span class="annottext">foldr2 :: forall a b c. (a -&gt; b -&gt; c -&gt; c) -&gt; c -&gt; [a] -&gt; [b] -&gt; c
</span><a href="GHC.List.html#foldr2"><span class="hs-identifier hs-var hs-var">foldr2</span></a></span></span><span> </span><span id="local-6989586621679485799"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; c
</span><a href="#local-6989586621679485799"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679485798"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485798"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; c
</span><a href="#local-6989586621679485797"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1291"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1292"></span><span>        </span><span id="local-6989586621679485797"><span class="annot"><span class="annottext">go :: [a] -&gt; [b] -&gt; c
</span><a href="#local-6989586621679485797"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span id="local-6989586621679485796"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485796"><span class="hs-identifier hs-var">_ys</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485798"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1293"></span><span>        </span><span class="annot"><a href="#local-6989586621679485797"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679485795"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485795"><span class="hs-identifier hs-var">_xs</span></a></span></span><span>   </span><span class="hs-special">[</span><span class="hs-special">]</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485798"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1294"></span><span>        </span><span class="annot"><a href="#local-6989586621679485797"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485794"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485794"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485793"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485793"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485792"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485792"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485791"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485791"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; c
</span><a href="#local-6989586621679485799"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485794"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485792"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; c
</span><a href="#local-6989586621679485797"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485793"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485791"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1295"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-pragma hs-type">foldr2</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>  </span><span class="hs-comment">-- See Note [Fusion for foldrN]</span><span>
</span><span id="line-1296"></span><span>
</span><span id="line-1297"></span><span id="local-6989586621679486398"><span id="local-6989586621679486399"><span id="local-6989586621679486400"><span id="local-6989586621679486401"><span class="annot"><a href="GHC.List.html#foldr2_left"><span class="hs-identifier hs-type">foldr2_left</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486401"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486400"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486399"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486398"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486398"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486401"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486400"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486399"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486400"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486398"><span class="hs-identifier hs-type">d</span></a></span></span></span></span></span><span>
</span><span id="line-1298"></span><span id="foldr2_left"><span class="annot"><span class="annottext">foldr2_left :: forall a b c d.
(a -&gt; b -&gt; c -&gt; d) -&gt; d -&gt; a -&gt; ([b] -&gt; c) -&gt; [b] -&gt; d
</span><a href="GHC.List.html#foldr2_left"><span class="hs-identifier hs-var hs-var">foldr2_left</span></a></span></span><span> </span><span id="local-6989586621679485789"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485789"><span class="hs-identifier hs-var">_k</span></a></span></span><span>  </span><span id="local-6989586621679485788"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485788"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679485787"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485787"><span class="hs-identifier hs-var">_x</span></a></span></span><span> </span><span id="local-6989586621679485786"><span class="annot"><span class="annottext">[b] -&gt; c
</span><a href="#local-6989586621679485786"><span class="hs-identifier hs-var">_r</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485788"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1299"></span><span class="annot"><a href="GHC.List.html#foldr2_left"><span class="hs-identifier hs-var">foldr2_left</span></a></span><span>  </span><span id="local-6989586621679485785"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485785"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679485784"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485784"><span class="hs-identifier hs-var">_z</span></a></span></span><span>  </span><span id="local-6989586621679485783"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485783"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span id="local-6989586621679485782"><span class="annot"><span class="annottext">[b] -&gt; c
</span><a href="#local-6989586621679485782"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485781"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485781"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485780"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485780"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485785"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485783"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485781"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b] -&gt; c
</span><a href="#local-6989586621679485782"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485780"><span class="hs-identifier hs-var">ys</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1300"></span><span>
</span><span id="line-1301"></span><span class="hs-comment">-- foldr2 k z xs ys = foldr (foldr2_left k z)  (\_ -&gt; z) xs ys</span><span>
</span><span id="line-1302"></span><span class="hs-pragma">{-# RULES</span><span>   </span><span class="hs-pragma">-- See Note [Fusion for foldrN]</span><span>
</span><span id="line-1303"></span><span id="local-6989586621679485779"><span class="annot"><span class="hs-pragma">&quot;foldr2/left&quot;</span></span><span>   </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485778"><span class="annot"><a href="#local-6989586621679485778"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679485777"><span class="annot"><a href="#local-6989586621679485777"><span class="hs-pragma hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679485776"><span class="annot"><a href="#local-6989586621679485776"><span class="hs-pragma hs-var">ys</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485775"><span class="annot"><a href="#local-6989586621679485775"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485774"><span class="annot"><a href="#local-6989586621679485774"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485779"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485774"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485774"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485774"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485774"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">.</span><span>
</span><span id="line-1304"></span><span>                  </span><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-pragma hs-type">foldr2</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485778"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485777"><span class="hs-pragma hs-type">z</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485775"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485776"><span class="hs-pragma hs-type">ys</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485775"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#foldr2_left"><span class="hs-pragma hs-type">foldr2_left</span></a></span><span>  </span><span class="annot"><a href="#local-6989586621679485778"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485777"><span class="hs-pragma hs-type">z</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span class="annot"><span class="hs-pragma">_</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485777"><span class="hs-pragma hs-type">z</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485776"><span class="hs-pragma hs-type">ys</span></a></span></span><span>
</span><span id="line-1305"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1306"></span><span>
</span><span id="line-1307"></span><span id="local-6989586621679486390"><span id="local-6989586621679486391"><span id="local-6989586621679486392"><span id="local-6989586621679486393"><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-identifier hs-type">foldr3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486393"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486392"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486391"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486390"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486390"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486390"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486393"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486392"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486391"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486390"><span class="hs-identifier hs-type">d</span></a></span></span></span></span></span><span>
</span><span id="line-1308"></span><span id="foldr3"><span class="annot"><span class="annottext">foldr3 :: forall a b c d.
(a -&gt; b -&gt; c -&gt; d -&gt; d) -&gt; d -&gt; [a] -&gt; [b] -&gt; [c] -&gt; d
</span><a href="GHC.List.html#foldr3"><span class="hs-identifier hs-var hs-var">foldr3</span></a></span></span><span> </span><span id="local-6989586621679485772"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d -&gt; d
</span><a href="#local-6989586621679485772"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679485771"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485771"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c] -&gt; d
</span><a href="#local-6989586621679485770"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1309"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1310"></span><span>    </span><span id="local-6989586621679485770"><span class="annot"><span class="annottext">go :: [a] -&gt; [b] -&gt; [c] -&gt; d
</span><a href="#local-6989586621679485770"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span>  </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[c]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485771"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1311"></span><span>    </span><span class="annot"><a href="#local-6989586621679485770"><span class="hs-identifier hs-var">go</span></a></span><span>  </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="annot"><span class="annottext">[c]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485771"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1312"></span><span>    </span><span class="annot"><a href="#local-6989586621679485770"><span class="hs-identifier hs-var">go</span></a></span><span>  </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>     </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485771"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1313"></span><span>    </span><span class="annot"><a href="#local-6989586621679485770"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485769"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485769"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485768"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485768"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485767"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485767"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485766"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485766"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485765"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485765"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485764"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485764"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d -&gt; d
</span><a href="#local-6989586621679485772"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485769"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485767"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485765"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c] -&gt; d
</span><a href="#local-6989586621679485770"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485768"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485766"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485764"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1314"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-pragma hs-type">foldr3</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>  </span><span class="hs-comment">-- See Note [Fusion for foldrN]</span><span>
</span><span id="line-1315"></span><span>
</span><span id="line-1316"></span><span>
</span><span id="line-1317"></span><span id="local-6989586621679486381"><span id="local-6989586621679486382"><span id="local-6989586621679486383"><span id="local-6989586621679486384"><span id="local-6989586621679486385"><span class="annot"><a href="GHC.List.html#foldr3_left"><span class="hs-identifier hs-type">foldr3_left</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486385"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486384"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486383"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486382"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486381"><span class="hs-identifier hs-type">e</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486381"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486385"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1318"></span><span>               </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486384"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486383"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486382"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486384"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486383"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486381"><span class="hs-identifier hs-type">e</span></a></span></span></span></span></span></span><span>
</span><span id="line-1319"></span><span id="foldr3_left"><span class="annot"><span class="annottext">foldr3_left :: forall a b c d e.
(a -&gt; b -&gt; c -&gt; d -&gt; e)
-&gt; e -&gt; a -&gt; ([b] -&gt; [c] -&gt; d) -&gt; [b] -&gt; [c] -&gt; e
</span><a href="GHC.List.html#foldr3_left"><span class="hs-identifier hs-var hs-var">foldr3_left</span></a></span></span><span> </span><span id="local-6989586621679485762"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d -&gt; e
</span><a href="#local-6989586621679485762"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679485761"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679485761"><span class="hs-identifier hs-var">_z</span></a></span></span><span> </span><span id="local-6989586621679485760"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485760"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679485759"><span class="annot"><span class="annottext">[b] -&gt; [c] -&gt; d
</span><a href="#local-6989586621679485759"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485758"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485758"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485757"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485757"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485756"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485756"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485755"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485755"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d -&gt; e
</span><a href="#local-6989586621679485762"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485760"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485758"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485756"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b] -&gt; [c] -&gt; d
</span><a href="#local-6989586621679485759"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485757"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485755"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1320"></span><span class="annot"><a href="GHC.List.html#foldr3_left"><span class="hs-identifier hs-var">foldr3_left</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d -&gt; e
</span><span class="hs-identifier">_</span></span><span>  </span><span id="local-6989586621679485754"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679485754"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[b] -&gt; [c] -&gt; d
</span><span class="hs-identifier">_</span></span><span>  </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[c]
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679485754"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-1321"></span><span>
</span><span id="line-1322"></span><span class="hs-comment">-- foldr3 k n xs ys zs = foldr (foldr3_left k n) (\_ _ -&gt; n) xs ys zs</span><span>
</span><span id="line-1323"></span><span class="hs-pragma">{-# RULES</span><span>   </span><span class="hs-pragma">-- See Note [Fusion for foldrN]</span><span>
</span><span id="line-1324"></span><span id="local-6989586621679485753"><span class="annot"><span class="hs-pragma">&quot;foldr3/left&quot;</span></span><span>   </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485752"><span class="annot"><a href="#local-6989586621679485752"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679485751"><span class="annot"><a href="#local-6989586621679485751"><span class="hs-pragma hs-var">z</span></a></span></span><span> </span><span class="hs-pragma">(</span><span id="local-6989586621679485750"><span class="annot"><a href="#local-6989586621679485750"><span class="hs-pragma hs-var">g</span></a></span></span><span class="hs-pragma">::</span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485749"><span class="annot"><a href="#local-6989586621679485749"><span class="hs-pragma hs-type">b</span></a></span></span><span class="hs-pragma">.</span><span class="hs-pragma">(</span><span class="annot"><a href="#local-6989586621679485753"><span class="hs-pragma hs-type">a</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485749"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485749"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485749"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">-&gt;</span><span class="annot"><a href="#local-6989586621679485749"><span class="hs-pragma hs-type">b</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">.</span><span>
</span><span id="line-1325"></span><span>                  </span><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-pragma hs-type">foldr3</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485752"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485751"><span class="hs-pragma hs-type">z</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485750"><span class="hs-pragma hs-type">g</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="#local-6989586621679485750"><span class="hs-pragma hs-type">g</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#foldr3_left"><span class="hs-pragma hs-type">foldr3_left</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485752"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485751"><span class="hs-pragma hs-type">z</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span class="annot"><span class="hs-pragma">_</span></span><span> </span><span class="annot"><span class="hs-pragma">_</span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679485751"><span class="hs-pragma hs-type">z</span></a></span><span class="hs-pragma">)</span></span><span>
</span><span id="line-1326"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1327"></span><span>
</span><span id="line-1328"></span><span class="hs-comment">{- Note [Fusion for foldrN]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
We arrange that foldr2, foldr3, etc is a good consumer for its first
(left) list argument. Here's how. See below for the second, third
etc list arguments

* The rule &quot;foldr2/left&quot; (active only before phase 1) does this:
     foldr2 k z (build g) ys = g (foldr2_left  k z) (\_ -&gt; z) ys
  thereby fusing away the 'build' on the left argument

* To ensure this rule has a chance to fire, foldr2 has a NOINLINE[1] pragma

There used to be a &quot;foldr2/right&quot; rule, allowing foldr2 to fuse with a build
form on the right. However, this causes trouble if the right list ends in
a bottom that is only avoided by the left list ending at that spot. That is,
foldr2 f z [a,b,c] (d:e:f:_|_), where the right list is produced by a build
form, would cause the foldr2/right rule to introduce bottom. Example:
  zip [1,2,3,4] (unfoldr (\s -&gt; if s &gt; 4 then undefined else Just (s,s+1)) 1)
should produce
  [(1,1),(2,2),(3,3),(4,4)]
but with the foldr2/right rule it would instead produce
  (1,1):(2,2):(3,3):(4,4):_|_

Note [Fusion for zipN/zipWithN]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We arrange that zip, zip3, etc, and zipWith, zipWit3 etc, are all
good consumers for their first (left) argument, and good producers.
Here's how.  See Note [Fusion for foldr2] for why it can't fuse its
second (right) list argument.

NB: Zips for larger tuples are in the List module.

* Rule &quot;zip&quot; (active only before phase 1) rewrites
    zip xs ys = build (\c n -&gt; foldr2 (zipFB c) n xs ys)
  See also Note [Inline FB functions]

  Ditto rule &quot;zipWith&quot;.

* To give this rule a chance to fire, we give zip a NOLINLINE[1]
  pragma (although since zip is recursive it might not need it)

* Now the rules for foldr2 (see Note [Fusion for foldr2]) may fire,
  or rules that fuse the build-produced output of zip.

* If none of these fire, rule &quot;zipList&quot; (active only in phase 1)
  rewrites the foldr2 call back to zip
     foldr2 (zipFB (:)) []   = zip
  This rule will only fire when build has inlined, which also
  happens in phase 1.

  Ditto rule &quot;zipWithList&quot;.
-}</span><span>
</span><span id="line-1380"></span><span>
</span><span id="line-1381"></span><span class="hs-comment">----------------------------------------------</span><span>
</span><span id="line-1382"></span><span class="hs-comment">-- | \(\mathcal{O}(\min(m,n))\). 'zip' takes two lists and returns a list of</span><span>
</span><span id="line-1383"></span><span class="hs-comment">-- corresponding pairs.</span><span>
</span><span id="line-1384"></span><span class="hs-comment">--</span><span>
</span><span id="line-1385"></span><span class="hs-comment">-- &gt;&gt;&gt; zip [1, 2] ['a', 'b']</span><span>
</span><span id="line-1386"></span><span class="hs-comment">-- [(1, 'a'), (2, 'b')]</span><span>
</span><span id="line-1387"></span><span class="hs-comment">--</span><span>
</span><span id="line-1388"></span><span class="hs-comment">-- If one input list is shorter than the other, excess elements of the longer</span><span>
</span><span id="line-1389"></span><span class="hs-comment">-- list are discarded, even if one of the lists is infinite:</span><span>
</span><span id="line-1390"></span><span class="hs-comment">--</span><span>
</span><span id="line-1391"></span><span class="hs-comment">-- &gt;&gt;&gt; zip [1] ['a', 'b']</span><span>
</span><span id="line-1392"></span><span class="hs-comment">-- [(1, 'a')]</span><span>
</span><span id="line-1393"></span><span class="hs-comment">-- &gt;&gt;&gt; zip [1, 2] ['a']</span><span>
</span><span id="line-1394"></span><span class="hs-comment">-- [(1, 'a')]</span><span>
</span><span id="line-1395"></span><span class="hs-comment">-- &gt;&gt;&gt; zip [] [1..]</span><span>
</span><span id="line-1396"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1397"></span><span class="hs-comment">-- &gt;&gt;&gt; zip [1..] []</span><span>
</span><span id="line-1398"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1399"></span><span class="hs-comment">--</span><span>
</span><span id="line-1400"></span><span class="hs-comment">-- 'zip' is right-lazy:</span><span>
</span><span id="line-1401"></span><span class="hs-comment">--</span><span>
</span><span id="line-1402"></span><span class="hs-comment">-- &gt;&gt;&gt; zip [] _|_</span><span>
</span><span id="line-1403"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1404"></span><span class="hs-comment">-- &gt;&gt;&gt; zip _|_ []</span><span>
</span><span id="line-1405"></span><span class="hs-comment">-- _|_</span><span>
</span><span id="line-1406"></span><span class="hs-comment">--</span><span>
</span><span id="line-1407"></span><span class="hs-comment">-- 'zip' is capable of list fusion, but it is restricted to its</span><span>
</span><span id="line-1408"></span><span class="hs-comment">-- first list argument and its resulting list.</span><span>
</span><span id="line-1409"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zip"><span class="hs-pragma hs-type">zip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>  </span><span class="hs-comment">-- See Note [Fusion for zipN/zipWithN]</span><span>
</span><span id="line-1410"></span><span id="local-6989586621679486374"><span id="local-6989586621679486375"><span class="annot"><a href="GHC.List.html#zip"><span class="hs-identifier hs-type">zip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486375"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486374"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486375"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486374"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span></span><span>
</span><span id="line-1411"></span><span id="zip"><span class="annot"><span class="annottext">zip :: forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.List.html#zip"><span class="hs-identifier hs-var hs-var">zip</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span id="local-6989586621679485748"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485748"><span class="hs-identifier hs-var">_bs</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1412"></span><span class="annot"><a href="GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span id="local-6989586621679485747"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485747"><span class="hs-identifier hs-var">_as</span></a></span></span><span>    </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1413"></span><span class="annot"><a href="GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485746"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485746"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485745"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485745"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485744"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485744"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485743"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485743"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485746"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485744"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a, b) -&gt; [(a, b)] -&gt; [(a, b)]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [(a, b)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485745"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485743"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-1414"></span><span>
</span><span id="line-1415"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zipFB"><span class="hs-pragma hs-type">zipFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-1416"></span><span id="local-6989586621679486368"><span id="local-6989586621679486369"><span id="local-6989586621679486370"><span id="local-6989586621679486371"><span class="annot"><a href="GHC.List.html#zipFB"><span class="hs-identifier hs-type">zipFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486371"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679486370"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486369"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486368"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486371"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486370"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486369"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486368"><span class="hs-identifier hs-type">d</span></a></span></span></span></span></span><span>
</span><span id="line-1417"></span><span id="zipFB"><span class="annot"><span class="annottext">zipFB :: forall a b c d. ((a, b) -&gt; c -&gt; d) -&gt; a -&gt; b -&gt; c -&gt; d
</span><a href="GHC.List.html#zipFB"><span class="hs-identifier hs-var hs-var">zipFB</span></a></span></span><span> </span><span id="local-6989586621679485741"><span class="annot"><span class="annottext">(a, b) -&gt; c -&gt; d
</span><a href="#local-6989586621679485741"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679485740"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485740"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485739"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485739"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679485738"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485738"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485740"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485739"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a, b) -&gt; c -&gt; d
</span><a href="#local-6989586621679485741"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485738"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1418"></span><span>
</span><span id="line-1419"></span><span class="hs-pragma">{-# RULES</span><span>  </span><span class="hs-pragma">-- See Note [Fusion for zipN/zipWithN]</span><span>
</span><span id="line-1420"></span><span class="annot"><span class="hs-pragma">&quot;zip&quot;</span></span><span>      </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485737"><span class="annot"><a href="#local-6989586621679485737"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679485736"><span class="annot"><a href="#local-6989586621679485736"><span class="hs-pragma hs-var">ys</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#zip"><span class="hs-pragma hs-type">zip</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485737"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485736"><span class="hs-pragma hs-type">ys</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485735"><span class="annot"><a href="#local-6989586621679485735"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485734"><span class="annot"><a href="#local-6989586621679485734"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-pragma hs-type">foldr2</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zipFB"><span class="hs-pragma hs-type">zipFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485735"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485734"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485737"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485736"><span class="hs-pragma hs-type">ys</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1421"></span><span class="annot"><span class="hs-pragma">&quot;zipList&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>  </span><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-pragma hs-type">foldr2</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zipFB"><span class="hs-pragma hs-type">zipFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span>   </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#zip"><span class="hs-pragma hs-type">zip</span></a></span><span>
</span><span id="line-1422"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1423"></span><span>
</span><span id="line-1424"></span><span class="hs-comment">----------------------------------------------</span><span>
</span><span id="line-1425"></span><span class="hs-comment">-- | 'zip3' takes three lists and returns a list of triples, analogous to</span><span>
</span><span id="line-1426"></span><span class="hs-comment">-- 'zip'.</span><span>
</span><span id="line-1427"></span><span class="hs-comment">-- It is capable of list fusion, but it is restricted to its</span><span>
</span><span id="line-1428"></span><span class="hs-comment">-- first list argument and its resulting list.</span><span>
</span><span id="line-1429"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zip3"><span class="hs-pragma hs-type">zip3</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1430"></span><span id="local-6989586621679486361"><span id="local-6989586621679486362"><span id="local-6989586621679486363"><span class="annot"><a href="GHC.List.html#zip3"><span class="hs-identifier hs-type">zip3</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486363"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486362"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486361"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486363"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486362"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486361"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-1431"></span><span class="hs-comment">-- Specification</span><span>
</span><span id="line-1432"></span><span class="hs-comment">-- zip3 =  zipWith3 (,,)</span><span>
</span><span id="line-1433"></span><span id="zip3"><span class="annot"><span class="annottext">zip3 :: forall a b c. [a] -&gt; [b] -&gt; [c] -&gt; [(a, b, c)]
</span><a href="GHC.List.html#zip3"><span class="hs-identifier hs-var hs-var">zip3</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485733"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485733"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485732"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485732"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485731"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485731"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485730"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485730"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485729"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485729"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485728"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485728"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485733"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485731"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485729"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a, b, c) -&gt; [(a, b, c)] -&gt; [(a, b, c)]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c] -&gt; [(a, b, c)]
forall a b c. [a] -&gt; [b] -&gt; [c] -&gt; [(a, b, c)]
</span><a href="GHC.List.html#zip3"><span class="hs-identifier hs-var">zip3</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485732"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485730"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485728"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1434"></span><span class="annot"><a href="GHC.List.html#zip3"><span class="hs-identifier hs-var">zip3</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">[c]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1435"></span><span>
</span><span id="line-1436"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zip3FB"><span class="hs-pragma hs-type">zip3FB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-1437"></span><span id="local-6989586621679486353"><span id="local-6989586621679486354"><span id="local-6989586621679486355"><span id="local-6989586621679486356"><span id="local-6989586621679486357"><span class="annot"><a href="GHC.List.html#zip3FB"><span class="hs-identifier hs-type">zip3FB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486357"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486356"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486355"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486354"><span class="hs-identifier hs-type">xs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486353"><span class="hs-identifier hs-type">xs'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486357"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486356"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486355"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486354"><span class="hs-identifier hs-type">xs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486353"><span class="hs-identifier hs-type">xs'</span></a></span></span></span></span></span></span><span>
</span><span id="line-1438"></span><span id="zip3FB"><span class="annot"><span class="annottext">zip3FB :: forall a b c xs xs'.
((a, b, c) -&gt; xs -&gt; xs') -&gt; a -&gt; b -&gt; c -&gt; xs -&gt; xs'
</span><a href="GHC.List.html#zip3FB"><span class="hs-identifier hs-var hs-var">zip3FB</span></a></span></span><span> </span><span id="local-6989586621679485726"><span class="annot"><span class="annottext">(a, b, c) -&gt; xs -&gt; xs'
</span><a href="#local-6989586621679485726"><span class="hs-identifier hs-var">cons</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679485725"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485725"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679485724"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485724"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679485723"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485723"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485722"><span class="annot"><span class="annottext">xs
</span><a href="#local-6989586621679485722"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485725"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485724"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485723"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(a, b, c) -&gt; xs -&gt; xs'
</span><a href="#local-6989586621679485726"><span class="hs-operator hs-var">`cons`</span></a></span><span> </span><span class="annot"><span class="annottext">xs
</span><a href="#local-6989586621679485722"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1439"></span><span>
</span><span id="line-1440"></span><span class="hs-pragma">{-# RULES</span><span>    </span><span class="hs-pragma">-- See Note [Fusion for zipN/zipWithN]</span><span>
</span><span id="line-1441"></span><span class="annot"><span class="hs-pragma">&quot;zip3&quot;</span></span><span>       </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485721"><span class="annot"><a href="#local-6989586621679485721"><span class="hs-pragma hs-var">as</span></a></span></span><span> </span><span id="local-6989586621679485720"><span class="annot"><a href="#local-6989586621679485720"><span class="hs-pragma hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621679485719"><span class="annot"><a href="#local-6989586621679485719"><span class="hs-pragma hs-var">cs</span></a></span></span><span class="hs-pragma">.</span><span> </span><span class="annot"><a href="GHC.List.html#zip3"><span class="hs-pragma hs-type">zip3</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485721"><span class="hs-pragma hs-type">as</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485720"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485719"><span class="hs-pragma hs-type">cs</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485718"><span class="annot"><a href="#local-6989586621679485718"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485717"><span class="annot"><a href="#local-6989586621679485717"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-pragma hs-type">foldr3</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zip3FB"><span class="hs-pragma hs-type">zip3FB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485718"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485717"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485721"><span class="hs-pragma hs-type">as</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485720"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485719"><span class="hs-pragma hs-type">cs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1442"></span><span class="annot"><span class="hs-pragma">&quot;zip3List&quot;</span></span><span>   </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>          </span><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-pragma hs-type">foldr3</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zip3FB"><span class="hs-pragma hs-type">zip3FB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#zip3"><span class="hs-pragma hs-type">zip3</span></a></span><span>
</span><span id="line-1443"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1444"></span><span>
</span><span id="line-1445"></span><span class="hs-comment">-- The zipWith family generalises the zip family by zipping with the</span><span>
</span><span id="line-1446"></span><span class="hs-comment">-- function given as the first argument, instead of a tupling function.</span><span>
</span><span id="line-1447"></span><span>
</span><span id="line-1448"></span><span class="hs-comment">----------------------------------------------</span><span>
</span><span id="line-1449"></span><span class="hs-comment">-- | \(\mathcal{O}(\min(m,n))\). 'zipWith' generalises 'zip' by zipping with the</span><span>
</span><span id="line-1450"></span><span class="hs-comment">-- function given as the first argument, instead of a tupling function.</span><span>
</span><span id="line-1451"></span><span class="hs-comment">--</span><span>
</span><span id="line-1452"></span><span class="hs-comment">-- &gt; zipWith (,) xs ys == zip xs ys</span><span>
</span><span id="line-1453"></span><span class="hs-comment">-- &gt; zipWith f [x1,x2,x3..] [y1,y2,y3..] == [f x1 y1, f x2 y2, f x3 y3..]</span><span>
</span><span id="line-1454"></span><span class="hs-comment">--</span><span>
</span><span id="line-1455"></span><span class="hs-comment">-- For example, @'zipWith' (+)@ is applied to two lists to produce the list of</span><span>
</span><span id="line-1456"></span><span class="hs-comment">-- corresponding sums:</span><span>
</span><span id="line-1457"></span><span class="hs-comment">--</span><span>
</span><span id="line-1458"></span><span class="hs-comment">-- &gt;&gt;&gt; zipWith (+) [1, 2, 3] [4, 5, 6]</span><span>
</span><span id="line-1459"></span><span class="hs-comment">-- [5,7,9]</span><span>
</span><span id="line-1460"></span><span class="hs-comment">--</span><span>
</span><span id="line-1461"></span><span class="hs-comment">-- 'zipWith' is right-lazy:</span><span>
</span><span id="line-1462"></span><span class="hs-comment">--</span><span>
</span><span id="line-1463"></span><span class="hs-comment">-- &gt;&gt;&gt; zipWith f [] _|_</span><span>
</span><span id="line-1464"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1465"></span><span class="hs-comment">--</span><span>
</span><span id="line-1466"></span><span class="hs-comment">-- 'zipWith' is capable of list fusion, but it is restricted to its</span><span>
</span><span id="line-1467"></span><span class="hs-comment">-- first list argument and its resulting list.</span><span>
</span><span id="line-1468"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith"><span class="hs-pragma hs-type">zipWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>  </span><span class="hs-comment">-- See Note [Fusion for zipN/zipWithN]</span><span>
</span><span id="line-1469"></span><span id="local-6989586621679486345"><span id="local-6989586621679486346"><span id="local-6989586621679486347"><span class="annot"><a href="GHC.List.html#zipWith"><span class="hs-identifier hs-type">zipWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486347"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486346"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486345"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486347"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486346"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486345"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span></span></span></span><span>
</span><span id="line-1470"></span><span id="zipWith"><span class="annot"><span class="annottext">zipWith :: forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.List.html#zipWith"><span class="hs-identifier hs-var hs-var">zipWith</span></a></span></span><span> </span><span id="local-6989586621679485716"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679485716"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c]
</span><a href="#local-6989586621679485715"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1471"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1472"></span><span>    </span><span id="local-6989586621679485715"><span class="annot"><span class="annottext">go :: [a] -&gt; [b] -&gt; [c]
</span><a href="#local-6989586621679485715"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1473"></span><span>    </span><span class="annot"><a href="#local-6989586621679485715"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1474"></span><span>    </span><span class="annot"><a href="#local-6989586621679485715"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485714"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485714"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485713"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485713"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485712"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485712"><span class="hs-identifier hs-var">y</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485711"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485711"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679485716"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485714"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485712"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c]
</span><a href="#local-6989586621679485715"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485713"><span class="hs-identifier hs-var">xs</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485711"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-1475"></span><span>
</span><span id="line-1476"></span><span class="hs-comment">-- zipWithFB must have arity 2 since it gets two arguments in the &quot;zipWith&quot;</span><span>
</span><span id="line-1477"></span><span class="hs-comment">-- rule; it might not get inlined otherwise</span><span>
</span><span id="line-1478"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zipWithFB"><span class="hs-pragma hs-type">zipWithFB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-1479"></span><span id="local-6989586621679486337"><span id="local-6989586621679486338"><span id="local-6989586621679486339"><span id="local-6989586621679486340"><span id="local-6989586621679486341"><span class="annot"><a href="GHC.List.html#zipWithFB"><span class="hs-identifier hs-type">zipWithFB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486341"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486340"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486339"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486338"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486337"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486341"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486338"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486337"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486340"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486339"><span class="hs-identifier hs-type">c</span></a></span></span></span></span></span></span><span>
</span><span id="line-1480"></span><span id="zipWithFB"><span class="annot"><span class="annottext">zipWithFB :: forall a b c d e.
(a -&gt; b -&gt; c) -&gt; (d -&gt; e -&gt; a) -&gt; d -&gt; e -&gt; b -&gt; c
</span><a href="GHC.List.html#zipWithFB"><span class="hs-identifier hs-var hs-var">zipWithFB</span></a></span></span><span> </span><span id="local-6989586621679485709"><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679485709"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485708"><span class="annot"><span class="annottext">d -&gt; e -&gt; a
</span><a href="#local-6989586621679485708"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679485707"><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485707"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679485706"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679485706"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621679485705"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485705"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">d
</span><a href="#local-6989586621679485707"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">d -&gt; e -&gt; a
</span><a href="#local-6989586621679485708"><span class="hs-operator hs-var">`f`</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679485706"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c
</span><a href="#local-6989586621679485709"><span class="hs-operator hs-var">`c`</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485705"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1481"></span><span>
</span><span id="line-1482"></span><span class="hs-pragma">{-# RULES</span><span>       </span><span class="hs-pragma">-- See Note [Fusion for zipN/zipWithN]</span><span>
</span><span id="line-1483"></span><span class="annot"><span class="hs-pragma">&quot;zipWith&quot;</span></span><span>       </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485704"><span class="annot"><a href="#local-6989586621679485704"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679485703"><span class="annot"><a href="#local-6989586621679485703"><span class="hs-pragma hs-var">xs</span></a></span></span><span> </span><span id="local-6989586621679485702"><span class="annot"><a href="#local-6989586621679485702"><span class="hs-pragma hs-var">ys</span></a></span></span><span class="hs-pragma">.</span><span>    </span><span class="annot"><a href="GHC.List.html#zipWith"><span class="hs-pragma hs-type">zipWith</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485704"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485703"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485702"><span class="hs-pragma hs-type">ys</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485701"><span class="annot"><a href="#local-6989586621679485701"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485700"><span class="annot"><a href="#local-6989586621679485700"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-pragma hs-type">foldr2</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zipWithFB"><span class="hs-pragma hs-type">zipWithFB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485701"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485704"><span class="hs-pragma hs-type">f</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485700"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485703"><span class="hs-pragma hs-type">xs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485702"><span class="hs-pragma hs-type">ys</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1484"></span><span class="annot"><span class="hs-pragma">&quot;zipWithList&quot;</span></span><span>   </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>  </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485699"><span class="annot"><a href="#local-6989586621679485699"><span class="hs-pragma hs-var">f</span></a></span></span><span class="hs-pragma">.</span><span>  </span><span class="annot"><a href="GHC.List.html#foldr2"><span class="hs-pragma hs-type">foldr2</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zipWithFB"><span class="hs-pragma hs-type">zipWithFB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485699"><span class="hs-pragma hs-type">f</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith"><span class="hs-pragma hs-type">zipWith</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485699"><span class="hs-pragma hs-type">f</span></a></span><span>
</span><span id="line-1485"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1486"></span><span>
</span><span id="line-1487"></span><span class="hs-comment">-- | The 'zipWith3' function takes a function which combines three</span><span>
</span><span id="line-1488"></span><span class="hs-comment">-- elements, as well as three lists and returns a list of the function applied</span><span>
</span><span id="line-1489"></span><span class="hs-comment">-- to corresponding elements, analogous to 'zipWith'.</span><span>
</span><span id="line-1490"></span><span class="hs-comment">-- It is capable of list fusion, but it is restricted to its</span><span>
</span><span id="line-1491"></span><span class="hs-comment">-- first list argument and its resulting list.</span><span>
</span><span id="line-1492"></span><span class="hs-comment">--</span><span>
</span><span id="line-1493"></span><span class="hs-comment">-- &gt; zipWith3 (,,) xs ys zs == zip3 xs ys zs</span><span>
</span><span id="line-1494"></span><span class="hs-comment">-- &gt; zipWith3 f [x1,x2,x3..] [y1,y2,y3..] [z1,z2,z3..] == [f x1 y1 z1, f x2 y2 z2, f x3 y3 z3..]</span><span>
</span><span id="line-1495"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith3"><span class="hs-pragma hs-type">zipWith3</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1496"></span><span id="local-6989586621679486328"><span id="local-6989586621679486329"><span id="local-6989586621679486330"><span id="local-6989586621679486331"><span class="annot"><a href="GHC.List.html#zipWith3"><span class="hs-identifier hs-type">zipWith3</span></a></span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486331"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486330"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486329"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-glyph">-&gt;</span><span class="annot"><a href="#local-6989586621679486328"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486331"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486330"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486329"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-glyph">-&gt;</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486328"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">]</span></span></span></span></span><span>
</span><span id="line-1497"></span><span id="zipWith3"><span class="annot"><span class="annottext">zipWith3 :: forall a b c d. (a -&gt; b -&gt; c -&gt; d) -&gt; [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="GHC.List.html#zipWith3"><span class="hs-identifier hs-var hs-var">zipWith3</span></a></span></span><span> </span><span id="local-6989586621679485698"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485698"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="#local-6989586621679485697"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1498"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1499"></span><span>    </span><span id="local-6989586621679485697"><span class="annot"><span class="annottext">go :: [a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="#local-6989586621679485697"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485696"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485696"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485695"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485695"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485694"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485694"><span class="hs-identifier hs-var">b</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485693"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485693"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679485692"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485692"><span class="hs-identifier hs-var">c</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679485691"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485691"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485698"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485696"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485694"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485692"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">d -&gt; [d] -&gt; [d]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; [b] -&gt; [c] -&gt; [d]
</span><a href="#local-6989586621679485697"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485695"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485693"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485691"><span class="hs-identifier hs-var">cs</span></a></span><span>
</span><span id="line-1500"></span><span>    </span><span class="annot"><a href="#local-6989586621679485697"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[b]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[c]
</span><span class="hs-identifier">_</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1501"></span><span>
</span><span id="line-1502"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">0</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith3FB"><span class="hs-pragma hs-type">zipWith3FB</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- See Note [Inline FB functions]</span><span>
</span><span id="line-1503"></span><span id="local-6989586621679486318"><span id="local-6989586621679486319"><span id="local-6989586621679486320"><span id="local-6989586621679486321"><span id="local-6989586621679486322"><span id="local-6989586621679486323"><span class="annot"><a href="GHC.List.html#zipWith3FB"><span class="hs-identifier hs-type">zipWith3FB</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486323"><span class="hs-identifier hs-type">d</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486322"><span class="hs-identifier hs-type">xs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486321"><span class="hs-identifier hs-type">xs'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486320"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486319"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486318"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486323"><span class="hs-identifier hs-type">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486320"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486319"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486318"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486322"><span class="hs-identifier hs-type">xs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486321"><span class="hs-identifier hs-type">xs'</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-1504"></span><span id="zipWith3FB"><span class="annot"><span class="annottext">zipWith3FB :: forall d xs xs' a b c.
(d -&gt; xs -&gt; xs') -&gt; (a -&gt; b -&gt; c -&gt; d) -&gt; a -&gt; b -&gt; c -&gt; xs -&gt; xs'
</span><a href="GHC.List.html#zipWith3FB"><span class="hs-identifier hs-var hs-var">zipWith3FB</span></a></span></span><span> </span><span id="local-6989586621679485689"><span class="annot"><span class="annottext">d -&gt; xs -&gt; xs'
</span><a href="#local-6989586621679485689"><span class="hs-identifier hs-var">cons</span></a></span></span><span> </span><span id="local-6989586621679485688"><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485688"><span class="hs-identifier hs-var">func</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679485687"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485687"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679485686"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485686"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679485685"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485685"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485684"><span class="annot"><span class="annottext">xs
</span><a href="#local-6989586621679485684"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b -&gt; c -&gt; d
</span><a href="#local-6989586621679485688"><span class="hs-identifier hs-var">func</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485687"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485686"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485685"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">d -&gt; xs -&gt; xs'
</span><a href="#local-6989586621679485689"><span class="hs-operator hs-var">`cons`</span></a></span><span> </span><span class="annot"><span class="annottext">xs
</span><a href="#local-6989586621679485684"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1505"></span><span>
</span><span id="line-1506"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1507"></span><span class="annot"><span class="hs-pragma">&quot;zipWith3&quot;</span></span><span>      </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485683"><span class="annot"><a href="#local-6989586621679485683"><span class="hs-pragma hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679485682"><span class="annot"><a href="#local-6989586621679485682"><span class="hs-pragma hs-var">as</span></a></span></span><span> </span><span id="local-6989586621679485681"><span class="annot"><a href="#local-6989586621679485681"><span class="hs-pragma hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621679485680"><span class="annot"><a href="#local-6989586621679485680"><span class="hs-pragma hs-var">cs</span></a></span></span><span class="hs-pragma">.</span><span>   </span><span class="annot"><a href="GHC.List.html#zipWith3"><span class="hs-pragma hs-type">zipWith3</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485683"><span class="hs-pragma hs-type">f</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485682"><span class="hs-pragma hs-type">as</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485681"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485680"><span class="hs-pragma hs-type">cs</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.Base.html#build"><span class="hs-pragma hs-type">build</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">\</span><span id="local-6989586621679485679"><span class="annot"><a href="#local-6989586621679485679"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679485678"><span class="annot"><a href="#local-6989586621679485678"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span class="hs-pragma">-&gt;</span><span> </span><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-pragma hs-type">foldr3</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zipWith3FB"><span class="hs-pragma hs-type">zipWith3FB</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485679"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485683"><span class="hs-pragma hs-type">f</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485678"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485682"><span class="hs-pragma hs-type">as</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485681"><span class="hs-pragma hs-type">bs</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485680"><span class="hs-pragma hs-type">cs</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1508"></span><span class="annot"><span class="hs-pragma">&quot;zipWith3List&quot;</span></span><span>  </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span>  </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679485677"><span class="annot"><a href="#local-6989586621679485677"><span class="hs-pragma hs-var">f</span></a></span></span><span class="hs-pragma">.</span><span>   </span><span class="annot"><a href="GHC.List.html#foldr3"><span class="hs-pragma hs-type">foldr3</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="GHC.List.html#zipWith3FB"><span class="hs-pragma hs-type">zipWith3FB</span></a></span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">:</span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679485677"><span class="hs-pragma hs-type">f</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="GHC.List.html#zipWith3"><span class="hs-pragma hs-type">zipWith3</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679485677"><span class="hs-pragma hs-type">f</span></a></span><span>
</span><span id="line-1509"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1510"></span><span>
</span><span id="line-1511"></span><span class="hs-comment">-- | 'unzip' transforms a list of pairs into a list of first components</span><span>
</span><span id="line-1512"></span><span class="hs-comment">-- and a list of second components.</span><span>
</span><span id="line-1513"></span><span class="hs-comment">--</span><span>
</span><span id="line-1514"></span><span class="hs-comment">-- &gt;&gt;&gt; unzip []</span><span>
</span><span id="line-1515"></span><span class="hs-comment">-- ([],[])</span><span>
</span><span id="line-1516"></span><span class="hs-comment">-- &gt;&gt;&gt; unzip [(1, 'a'), (2, 'b')]</span><span>
</span><span id="line-1517"></span><span class="hs-comment">-- ([1,2],&quot;ab&quot;)</span><span>
</span><span id="line-1518"></span><span id="local-6989586621679486310"><span id="local-6989586621679486311"><span class="annot"><a href="GHC.List.html#unzip"><span class="hs-identifier hs-type">unzip</span></a></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486311"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486310"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486311"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486310"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-1519"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#unzip"><span class="hs-pragma hs-type">unzip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1520"></span><span class="hs-comment">-- Inline so that fusion `foldr` has an opportunity to fire.</span><span>
</span><span id="line-1521"></span><span class="hs-comment">-- See Note [Inline @unzipN@ functions] in GHC/OldList.hs.</span><span>
</span><span id="line-1522"></span><span id="unzip"><span class="annot"><span class="annottext">unzip :: forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="GHC.List.html#unzip"><span class="hs-identifier hs-var hs-var">unzip</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">((a, b) -&gt; ([a], [b]) -&gt; ([a], [b]))
-&gt; ([a], [b]) -&gt; [(a, b)] -&gt; ([a], [b])
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679485676"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485676"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485675"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485675"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679485674"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485674"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485673"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485673"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485676"><span class="hs-identifier hs-var">a</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485674"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485675"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485673"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1523"></span><span>
</span><span id="line-1524"></span><span class="hs-comment">-- | The 'unzip3' function takes a list of triples and returns three</span><span>
</span><span id="line-1525"></span><span class="hs-comment">-- lists, analogous to 'unzip'.</span><span>
</span><span id="line-1526"></span><span class="hs-comment">--</span><span>
</span><span id="line-1527"></span><span class="hs-comment">-- &gt;&gt;&gt; unzip3 []</span><span>
</span><span id="line-1528"></span><span class="hs-comment">-- ([],[],[])</span><span>
</span><span id="line-1529"></span><span class="hs-comment">-- &gt;&gt;&gt; unzip3 [(1, 'a', True), (2, 'b', False)]</span><span>
</span><span id="line-1530"></span><span class="hs-comment">-- ([1,2],&quot;ab&quot;,[True,False])</span><span>
</span><span id="line-1531"></span><span id="local-6989586621679486305"><span id="local-6989586621679486306"><span id="local-6989586621679486307"><span class="annot"><a href="GHC.List.html#unzip3"><span class="hs-identifier hs-type">unzip3</span></a></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679486307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486306"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679486305"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486307"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486306"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621679486305"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-1532"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="GHC.List.html#unzip3"><span class="hs-pragma hs-type">unzip3</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1533"></span><span class="hs-comment">-- Inline so that fusion `foldr` has an opportunity to fire.</span><span>
</span><span id="line-1534"></span><span class="hs-comment">-- See Note [Inline @unzipN@ functions] in GHC/OldList.hs.</span><span>
</span><span id="line-1535"></span><span id="unzip3"><span class="annot"><span class="annottext">unzip3 :: forall a b c. [(a, b, c)] -&gt; ([a], [b], [c])
</span><a href="GHC.List.html#unzip3"><span class="hs-identifier hs-var hs-var">unzip3</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">((a, b, c) -&gt; ([a], [b], [c]) -&gt; ([a], [b], [c]))
-&gt; ([a], [b], [c]) -&gt; [(a, b, c)] -&gt; ([a], [b], [c])
forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
</span><a href="GHC.Base.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-special">(</span><span id="local-6989586621679485672"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485672"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485671"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485671"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485670"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485670"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679485669"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485669"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485668"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485668"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679485667"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485667"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679485672"><span class="hs-identifier hs-var">a</span></a></span><span class="annot"><span class="annottext">a -&gt; [a] -&gt; [a]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621679485669"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679485671"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">b -&gt; [b] -&gt; [b]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621679485668"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621679485670"><span class="hs-identifier hs-var">c</span></a></span><span class="annot"><span class="annottext">c -&gt; [c] -&gt; [c]
forall {t}. t -&gt; [t] -&gt; [t]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621679485667"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1536"></span><span>                  </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1537"></span><span>
</span><span id="line-1538"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-1539"></span><span class="hs-comment">-- Error code</span><span>
</span><span id="line-1540"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-1541"></span><span>
</span><span id="line-1542"></span><span class="hs-comment">-- Common up near identical calls to `error' to reduce the number</span><span>
</span><span id="line-1543"></span><span class="hs-comment">-- constant strings created when compiled:</span><span>
</span><span id="line-1544"></span><span>
</span><span id="line-1545"></span><span id="local-6989586621679486573"><span class="annot"><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-type">errorEmptyList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679486573"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1546"></span><span id="errorEmptyList"><span class="annot"><span class="annottext">errorEmptyList :: forall a. String -&gt; a
</span><a href="GHC.List.html#errorEmptyList"><span class="hs-identifier hs-var hs-var">errorEmptyList</span></a></span></span><span> </span><span id="local-6989586621679485666"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679485666"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1547"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; a
forall a. String -&gt; a
</span><a href="GHC.Err.html#errorWithoutStackTrace"><span class="hs-identifier hs-var">errorWithoutStackTrace</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><a href="GHC.List.html#prel_list_str"><span class="hs-identifier hs-var">prel_list_str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679485666"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: empty list&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1548"></span><span>
</span><span id="line-1549"></span><span class="annot"><a href="GHC.List.html#prel_list_str"><span class="hs-identifier hs-type">prel_list_str</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-1550"></span><span id="prel_list_str"><span class="annot"><span class="annottext">prel_list_str :: String
</span><a href="GHC.List.html#prel_list_str"><span class="hs-identifier hs-var hs-var">prel_list_str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Prelude.&quot;</span></span><span>
</span><span id="line-1551"></span></pre></body></html>